After installing the project, you need to configure the framework itself. In the previous step, the project was installed in the new_project directory (or any other directory name you chose), to execute the following console commands, you need to navigate to this directory:
$cd new_project
The example provided may differ for various console environments.
It is assumed that all console commands in the documentation are run from this root project directory unless otherwise specified.
If the application is running on a host where the framework’s console commands are not available, they can be executed via the framework’s special Web Console.
By default, in DEBUG mode, this permission setting is not necessary, and hosting usually provides advanced permissions, so if the project is in development mode or on a hosting, this step can be skipped.
After installing the HLEB2 framework on Linux, it is necessary to configure permissions. To do this, you need to know the web server group's name. Next, here's how you can set extended edit permissions for files in the project's /storage/ directory. The web server may be named www-data, and its group may be named the same www-data. When running the framework, if the permissions are not yet set, an error will be displayed attempting to determine the active web server's name and group. To allow new files created by the web server to be editable via the console by the current user, add the user to the web server group:
$sudo usermod -aG www-data ${USER}
After these group changes, to apply them, you need to log out and log back into the system as this user, or run the following command:
$su - ${USER}
The next check should display 'www-data' in the group list:
$id -nG
Then, extend permissions on the /storage/ directory for the group (from the root directory of the project).
$sudo chmod -R 750 ./ ; sudo chmod -R 770 ./storage
After setting permissions, if needed, you can use the framework's own console commands. If the project was installed not via Composer, which should have executed this script automatically (and then removed it), run the command manually:
$php console project-setup-task
This action will perform several minor optimizations of the project that do not directly affect its operability.
The /config/ directory is often used to store the project's settings. If you want to fetch additional settings using the framework, add them to the /config/main.php file in a similar manner to its settings. However, if there are many such settings, it is advisable to use the 'custom.setting.files' parameter from the /config/system.php file and list files containing separate settings.
The 'start.unixtime' parameter under the settings name 'common' contains the UNIX time of the request processing start by the framework in milliseconds. This parameter remains constant throughout the request.
A universal class autoloader is provided alongside Composer, and its use is preferred. If a file (class) is not found, an attempt will be made to load it with the framework’s auxiliary autoloader, which follows PSR-0 naming conventions and works independently of Composer. For instance, for the framework's autoloader, the class App\Controllers\ExampleController should correspond to the file /app/Controllers/ExampleController.php in the project.
For enhanced performance, add the following directive for the preload.php file in your current php.ini file to precompile the framework's classes and place them in the opcode cache.
opcache.preload=/path/to/project/vendor/phphleb/framework/preload.php
In this line, replace '/path/to/project/' with the path to your project's root directory.
Learn more about preloading in the PHP documentation.
Preloading is not supported on Windows.
When deploying the project for production (target public server), you can reduce the framework size by 30% by removing code comments using a dedicated console command.
$php console clearing-comment-feature
← Project Installation Configuration Setup →