PHP -Using Composer (For Beginner)
Using Composer First Time
Introduction#
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
Dependency management#
Composer is not a package manager in the same sense as Yum or Apt are. Yes, it deals with "packages" or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor
) inside your project. By default, it does not install anything globally. Thus, it is a dependency manager. It does however support a "global" project for convenience via the global command.
https://getcomposer.org/doc/00-intro.md
1. Download Composer
2. Install Composer
Composer will work with PHP so we assume you have installed wamp or xampp (in my case its XAMPP).
Open composer-setup.exe to install composer. During Installation, it will ask you to "choose command line php you want to use". Select the php installation folder. It will be folder inside your web server (wamp/xamp)
In my case we have installed xamp so php folder location will be "
C:\xampp\php" so we will select "php.exe" inside php folder.The select path will be
C:\xampp\php\php.exe
3. Usage
After installation you can use composer using command line (CMD). Open CMD and change directory to the location where you want to use composer. Then use the composer commands
Create New Composer File
composer init
composer init
Download any package (like php mailer)
composer require phpmailer/phpmailer
composer require phpmailer/phpmailer
Comments
Post a Comment