Composer is an application level package manager for the PHP language that provides a standard format for managing dependencies of PHP software and libraries. In other words we can say that, “it is a tool for dependency management in PHP”, which deals with “packages” and “libraries”.
Composer runs on “command line” and allows you to declare the libraries your projects depends on and it will manage (install/update) them for you. But it manages them on a per-project basis and installing them in a directory inside your project.
Note: Composer is strongly inspired by Node.js’s “npm” and Ruby’s “bundler”.
Composer allows users to install PHP application that are available on “Packagist” which is its main repository containing available packages. Link: https://packagist.org.
Composer offers several commands parameters including:
1) require: this command add the library in parameter to the file “composer.json” and install it.
2) install: this command install all libraries from “composer.json”, and use to download all PHP repository dependencies.
3) update: update all libraries form “composer.json”.
4) remove: uninstall a library and remove it from “composer.json”.
Basically, to work in the Laravel framework you have to install the composer first. Without composer Laravel framework does not work. So, before using Laravel, make sure you have composer install on your machine.
Installing Composer is easy. You can get information about installing composer at https://getcomposer.org/.
After download and run composer-setup.exe. It will install the latest Composer version and set up your PATH so that you can call “composer” from any directory in your command line.
In Laravel, composer commands are used for creating the project, as well as used for update the laravel version, clear cache, upgrade and for other work as per requirement.
For creating the Laravel project, type the command in your terminal “composer create-project –prefer-dist laravel/laravel projectname”. Without Composer command, Laravel project will not create.
Tags: What is Composer