What is composer?
If you're a PHP developer and has been coding up for years, you may have noticed that while developing in PHP, you have to re-invent the wheel every single time.
If you’re a
PHP developer and has been coding up for years, you may have noticed that while developing in PHP, you have to re-invent the wheel every single time. You have to re-write several modules over and over again. You have to include and require your files every single time. Composer is basically the solution to all of these problems.
Composer is a dependency manager for PHP. Composer will handle all the dependencies required in your application by pulling in all the required libraries and extensions and manage them in one place.
Composer is for
NPM is for
You can use composer in your PHP project by simply
init composer in your project.
$ composer init
This command will get you through the basic configurations for your application, such as
- Package Name
- Minimum Stability
- Package Type
This will generate a
composer.json file for you. You can then run:
$ composer install
Well, that’s it. you are all set to go.