Forrest logo
tool overview
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/composer
    try on your machine
    explain 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} --all
    try on your machine
    explain this command
  • php-artisan:tldr:a42bd php-artisan: Start an interactive PHP command-line interface.
    $ php artisan tinker
    try on your machine
    explain this command
  • php-artisan:tldr:a520d php-artisan: Display a list of all available commands.
    $ php artisan help
    try on your machine
    explain this command
  • php-artisan:tldr:a53eb php-artisan: Start PHP's built-in web server for the current Laravel application.
    $ php artisan serve
    try on your machine
    explain this command
  • php-yii:tldr:299fb php-yii: Display a list of all available commands.
    $ php yii ${help}
    try on your machine
    explain 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 machine
    explain this command
  • php:code-beautifier-and-fixer:run Run PHP Code Beautifier and Fixer
    $ php vendor/bin/phpcbf
    try on your machine
    explain this command
  • php:code:run Run PHP code (Notes: Don't use tags; escape double quotes with backslash).
    $ php -r "${code}"
    try on your machine
    explain this command
  • php:config:show Show the PHP configuration for the CLI version
    $ php -i
    try on your machine
  • php:extensions:list Get a list of installed PHP extensions.
    $ php -m
    try on your machine
    explain this command
  • php:function:information Display information about a specific function.
    $ php --rf ${function_name}
    try on your machine
    explain this command
  • php:ini:which Show the location of the php.ini file (CLI)
    $ php -i | grep php\.ini
    try 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:run:interactively Run PHP interactively.
    $ php -a
    try on your machine
    explain this command
  • 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 machine
    explain this command
  • php:server:start Starting the built-in web server
    $ php -S localhost:8000
    try on your machine
    explain this command
  • symfony:bundle:create Create a Symfony bundle
    $ php bin/console make:bundle
    try on your machine
    explain this command
  • symfony:cache:clear Clear the Symfony cache
    $ php bin/console cache:clear
    try on your machine
  • symfony:database:update:force Update the database (force)
    $ php bin/console doctrine:schema:update --force
    try on your machine
tool overview