Help:Using Composer

Composer is a dependency manager for PHP. For a more in-depth understanding on how Composer works and how to interpret the  file, see Composer net.tuts tutorial.

Hosting with shell access

 * Installing Composer globally (recommended)

Shared hosting
Download  using into the same folder where the  file is located (Installing Composer locally).

The next step is to run  in order to download all necessary libraries (into the   directory).


 * Related links
 * Using Composer on a VPS that runs Ubuntu
 * Installing Composer on a shared Dreamhost Server
 * PHP Composer on shared hosting

Adding packages
Installing a package can be done by running.

The  command consists of two parts, the name of the package and second devided by a colon represents the version to be installed.

~/^ usage and meaning
The tilde section describes its expected behavior in detail but in short it allows to specify a range of allowed release tags. If with the next  execution a new update is available (new release, bugfix etc.) it will be automatically pulled together with all its dependencies. Something like  indicates an equivalence to.

Fetching a distinct release
If for some reason you want to use a different release other than the latest available then using a distinct release tag without the   is a viable option but it will lock the release to a specific version and available updates (for bugfixes etc.) will not be fetched on the next   run therefore it is not the preferred option.

Remove packages
Remove the  from the   repositories section and run.

Update packages and dependencies
If a new release is available run  and if for some reason you need to pull directly from master (using  ) it is recommended that after executing   you run   from the MW root directory.

Using development fork
Sometimes you may want to load a package directly from a version control system (VCS) like on GitHub. There are a few use cases for this. The most common one is maintaining your own fork during softwatre development time. To use your own fork, change the "composer.json" file as follows:

Now, run

Improve autoloader
Composer recommends to use dump-autoload together with option  to get a faster autoloader especially for production environments. will convert PSR-0/4 packages into a classmap in order to optimize the loading of classes.

FAQ

 * Installation concerns and questions
 * Installing SMW without composer