220.127.116.11.5. Artisan Utility
The Artisan utility is a console interface for working with the Laravel framework that comes with it and is installed with project creation... This utility simplifies the work with the framework and provides a huge range of possibilities.
The utility and its commands are launched directly from the framework project directory. To use do the following:
- Change to your project directory by running the command:
example.com/wwwindicate site root directory.
- By default in the environment SSH the hosting uses PHP 5.6. According to the requirements of the framework, a version of at least 7.3 is required, so override the paths in the variable
$PATHby running the command:
- Run the command to check if Artisan is working:
- Subsequent command run
artisanpossible only from its catalog. If you need to create a command that will be called without the need to go to the directory, then run the following command:
echo "alias command='/usr/local/php73/bin/php ~/example.com/www/artisan'" >> ~/.bashrc && source ~/.bashrc
Modify the above command based on the information you need:
- Instead «command» provide the desired command name to be used. For example, you can specify the name of the project by type
- Instead «example.com/www» indicate site root directory.
- Test the command by running:
The standard output of this command will be the version of the installed framework.
To list the available commands, run the following command:
php artisan list
For all commands, you can get help on how to use them. To do this, use the command
help with the name of the command for which you want to get information:
php artisan help list
If you enter a command incorrectly, similar options will be offered, for example:
You can familiarize yourself with how Artisan commands work in laravel.su documentation1) or in official documentation.
| ||Remove compiled class files|
| ||Enable Maintenance Mode / Demo Mode|
| ||Displaying the current parameters of the framework environment|
| ||Help output by command|
| ||Inspirational quote conclusion|
| ||Getting a list of available commands|
| ||Starting Database Migration|
| ||Optimizing include files by creating cache files|
| ||Starting the server (within the framework of shared hosting, the command will not work correctly)|
| ||Run application tests|
| ||Interacting with the application|
| ||Disable Maintenance Mode / Demo Mode|