On this page you find all important commands for the CLI tool php. If the
command you are looking for is missing please ask our AI.
php
PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by The PHP Group. PHP was originally an abbreviation of Personal Home Page, but it now stands for the recursive initialism PHP: Hypertext Preprocessor.
Articles in our magazine for php:
PHP and the Command Line: the perfect match
PHP happens mostly in the IDE and with the command line you come into contact less often. Nevertheless, there are many helpful commands.
List of commands for php:
-
composer:install Install composer PHP package installer$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php composer-setup.php
$ php -r "unlink('composer-setup.php');"
$ sudo mv composer.phar /usr/local/bin/composertry on your machineexplain this command -
php-artisan:tldr:1863b php-artisan: Generate a new Eloquent model class with a migration, factory and resource controller.$ php artisan make:model ${ModelName} --alltry on your machineexplain this command
-
php-artisan:tldr:a42bd php-artisan: Start an interactive PHP command-line interface.$ php artisan tinkertry on your machineexplain this command
-
php-artisan:tldr:a520d php-artisan: Display a list of all available commands.$ php artisan helptry on your machineexplain this command
-
php-artisan:tldr:a53eb php-artisan: Start PHP's built-in web server for the current Laravel application.$ php artisan servetry on your machineexplain this command
-
php-yii:tldr:299fb php-yii: Display a list of all available commands.$ php yii ${help}try on your machineexplain this command
-
php-yii:tldr:9a0b1 php-yii: Generate a controller, views and related files for the CRUD actions on the specified model class.$ php yii ${gii-crud} --modelClass=${ModelName} --controllerClass=${ControllerName}try on your machineexplain this command
-
php:code-beautifier-and-fixer:run Run PHP Code Beautifier and Fixer$ php vendor/bin/phpcbftry on your machineexplain this command
-
php:code:run Run PHP code (Notes: Don't use ?> tags; escape double quotes with backslash).$ php -r "${code}"try on your machineexplain this command
-
php:config:show Show the PHP configuration for the CLI version$ php -itry on your machine
-
php:extensions:list Get a list of installed PHP extensions.$ php -mtry on your machineexplain this command
-
php:function:information Display information about a specific function.$ php --rf ${function_name}try on your machineexplain this command
-
php:ini:which Show the location of the php.ini file (CLI)$ php -i | grep php\.initry on your machine
-
php:lint Check for syntax errors in php files (linting)$ php -l ${filename}try on your machine
-
php:phar:decompress Decompress a phar file to a given directory$ php -r '$phar = new Phar("${phar_file}"); $phar->extractTo("${directory_to_decompress_to}");'try on your machine
-
php:script:run Run a PHP CLI script$ php ${filename}try on your machine
-
php:script:run:memory_limit Run a PHP CLI script with a defined memory limit$ php -d memory_limit=${limit_in_megabyte}M ${filename}try on your machineexplain this command
-
php:server:start Starting the built-in web server$ php -S localhost:8000try on your machineexplain this command
-
symfony:bundle:create Create a Symfony bundle$ php bin/console make:bundletry on your machineexplain this command
-
symfony:cache:clear Clear the Symfony cache$ php bin/console cache:cleartry on your machine
-
symfony:database:update:force Update the database (force)$ php bin/console doctrine:schema:update --forcetry on your machine