-
Notifications
You must be signed in to change notification settings - Fork 0
Autoloaders
Giuseppe Trivisano edited this page May 16, 2025
·
4 revisions
There are three autoloaders in this project that must be called at the beginning of the webhook file (hook.php):
-
vendor/autoload.phploads the Composer's libraries and all their classes -
project_autoloader.phploads all the classes of the project except for thecontrol/classes -
control/processes_autoloader.phploads the classes of processes, handled differently from the others
To make the project_autoloader.php work properly you must meet the PSR-4 standard.
These are the main rules:
- for each new class created, the class name and the file name must be the same:
// inside Transaction.php file
class Transaction { ... }- the new classes must have the namespace definition like this:
// inside entities/banking/Transaction.php file
namespace CustomBotName\entities\banking;
class Transaction { ... }The CustomBotName is the vendor namespace and should be modified, as explained in the installation section, before starting developing with the following command, putting your bot name in place of <HERE_YOUR_BOT_NAME>:
cd /path/to/project/
find . -type f -not -path ".git" -exec sed -i 's/CustomBotName/<HERE_YOUR_BOT_NAME>/g' {} \;to be continued (explain the processes_autoloader.php)