Composer: commands for an application level package manager for a PHP programming language

Lecture



Composer: commands for an application level package manager for a PHP programming language

Brief and clear about all com *** ah Composer.

coma description
composer require vendor/package Adds the required package to the composer.json file and installs it in your project.

Com *** and require changes composer.json , located in the current folder. If a package requires dependencies, they will be installed or updated. And also will be updated composer.lock .
composer install If the composer.lock file does not exist, resolves the dependencies based on composer.json and creates it. Next, it analyzes the composer.lock file, downloads and installs the versions of the packages specified in it.
The option --no-scripts is useful for bypassing running scripts specified in the pre- and post-settings.
composer update Updates your dependencies to the latest versions and updates composer.lock .

Kom *** and update resolves dependencies to get the latest versions of packages dependent on each other.
composer update --lock Sometimes, you may get this warning:
 If you’re getting outdated, you can’t get outdated. 
This can happen after you manually edited composer.json (added or modified description , authors , extra , etc.). Even if your changes are insignificant for Composer, it detects that the md5sum file is changed, and warns that these changes are not taken into account in the composer.lock file.

Therefore, to suppress this warning, you can simply run the *** *** update --lock to update the lock file without updating the packages themselves.
composer dump-autoload --optimize If you need to update the bootloader, dump-autoload new classes have appeared, you can run the *** command at dump-autoload to avoid installing or updating packages.

Use the --optimize switch to convert PSR-0 to autoload as for a classmap so that the autoloader is the fastest. This is highly recommended for production ( you can get a 20% increase ) , but it may take a little time to run, so this is not currently done by default.

You can also use the dumpautoload alias.
composer about Summary of Composer.
composer archive vendor/package Create an archive for the specified package. Com *** and can also be used to archive the entire project without excluded / ignored files.
composer browse Nickname for home , opens the URL of the package or its home page in the browser.
composer clear-cache The alias of the clearcache command clears the internal cache of Composer packages.
composer config --list Allows you to edit some basic Composer settings either in the local composer.json file or in the global config.json file.
composer create-project vendor/package dir/ Create a new project from the specified package in the specified directory.
composer depends vendor/package Tells you what other packages depend on the specific (specified) package. You can specify which types of links (require, require-dev) should be included in the listing. By default, both are displayed.
composer diagnose If you think you have found a mistake, or something is behaving strangely, you may want to run a *** command in diagnostics to perform automated checks for many common problems.
composer global A com *** and global allows other commands such as install , require or update to run as if you ran them from the COMPOSER_HOME directory.

It can be used for installing command utilities globally. If you add $COMPOSER_HOME/vendor/bin to the $PATH variable of your environment, then launching the utilities will become quite simple.
For example, install php-cs-fixer :
$ php composer.phar global require fabpot/php-cs-fixer:dev-master
Now the executable file php-cs-fixer is available globally and you can run it from anywhere (of course, if you set up your PATH variable).
composer help [command] Displays help for all other commands: composer.phar help install .
composer init Creates a basic version of the composer.json file in the current directory.

When you run the command, Composer will interactively query the field values ​​to fill in, using smart defaults for some fields.
composer licenses Show dependency license information.
composer list Displays a list of valid commands.
composer remove Removes a package from the require or require-dev sections: remove vendor/package vendor/package2 .
composer run-script Run manually the scripts declared in composer.json . Just pass the name of the script and, if necessary, --no-dev to disable the dev mode.
composer search ключевые слова Search for packages.

The com *** and search allows you to search the repositories of the current project (see the "repositories" section in composer.json ). Usually it will only packagist.org. You just need to pass the search word to the team.
composer self-update Update composer.phar itself to the latest version.

Running the self-update command can solve some problems and save you time.

You can also use the selfupdate alias selfupdate .
composer show List of all installed packages ( composer show ).
List of all available packages ( composer show --all ).
Info about the specified package or its specific version ( composer show vendor/package [версия] ).
composer suggest Displays a list of all packages proposed installed. Optionally, you can transfer one or more package names in the format vendor/package to limit the output to only those that were suggested.
composer status If you often have to modify the code of your dependencies, and they were installed "from source" (see the option of the require command - --prefer-source ), then
com *** and status will allow you to check if you have local changes to any of them.
composer validate Checks the file composer.json .

You should always run *** at validate before committing your composer.json and before installing the release tag. This com *** will check it for errors.

Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Famworks

Terms: Famworks