Help:Composer
Table of Contents | |
---|---|
Composer is a dependency manager for PHP. For a more in-depth understanding on how Composer works and how to interpret the composer.json
file, see Composer net.tuts tutorial.
Usage
Adding packages
Installing a package can be done by running composer require "PackageNameIs:ForVersion"
.
The require
command consists of two parts, the name of the package and second devided by a colon represents the version to be installed.
Remove packages
Remove the PackageNameIs
from the composer.json
repositories section and run composer update
.
Update packages and dependencies
If a new release is available run composer update
and if for some reason you need to pull directly from master (using git pull/git fetch
) it is recommended that after executing git
you run composer dump-autoload
from the MW root directory.
Using development versions
!! Add something here !!
Improve autoloader
Composer recommends to use dump-autoload together with option -o
to get a faster autoloader especially for production environments. dump-autoload
will convert PSR-0/4 packages into a classmap in order to optimize the loading of classes.
Download composer.phar
using curl -s http://getcomposer.org/installer | php
into the same folder where the composer.json
file is located.
The next step is to run php composer.phar install
in order to download all necessary libraries (into the extension/ or vendor/
directory).
- Related links
- Using Composer on a VPS that runs Ubuntu
- Installing Composer on a shared Dreamhost Server
- PHP Composer on shared hosting
Individual file release
Note: Access to a server is needed for this to work, so you might have to ask somebody to do this.
If the above steps didn't work (due to configuration restrictions on part of the hosting company or missing CLI
access), it it is suggested to run a local copy and upload the generated files together with the /vendor
directory to the target destination:
- Create a directory on your server which is able to handle Composer:
Change "w" to the name of the script path you are using for your wiki.mkdir w - Change into the newly created directory: cd w
- Place your "composer.json" file in this directory.
- Run Composer to generate the necessary directories and files either with
if Composer was installed locally (see above) in this directory orphp composer.phar update
if Composer was installed globally. You will get the new subdirectories called /extensions/ and /vendor/.composer update - Copy the contents of the "/w/" directory and its subdirectories to the destination on the server which cannot handle Composer.
- Do the rest of the installation of SMW and enjoy!
FAQ
!! Add something here !!
- http://wikimedia.7.x6.nabble.com/SMW-1-9-Installation-Concerns-and-Questions-td5019527.html
- http://wikimedia.7.x6.nabble.com/Installing-SMW-1-9-without-Composer-td5021622.html