Define Your Dependencies

Put a file named composer.json at the root of your project, containing your project dependencies:

{ "require": { "vendor/package": "1.3.2", "vendor/package2": "1.*", "vendor/package3": "^2.0.3" } }

For more information about packages versions usage, see the composer documentation.

Install Composer In Your Project

Run this in your command line:

curl -sS https://getcomposer.org/installer | php

Or download composer.phar into your project root.

See the Composer documentation for complete installation instructions on various platforms.

Install Dependencies

Execute this in your project root.

php composer.phar install

Autoload Dependencies

If your packages specify autoloading information, you can autoload all the dependencies by adding this to your code:

require 'vendor/autoload.php';

Browse the packages we have to find more great libraries you can use in your project.