src
11 years ago
tests
11 years ago
.editorconfig
11 years ago
.gitignore
11 years ago
.travis.yml
11 years ago
LICENSE
11 years ago
README.md
11 years ago
composer.json
11 years ago
phpunit.xml.dist
11 years ago
README.md
163 lines
| 1 | # A Multi-Framework [](http://getcomposer.orgComposer](http://getcomposer.org](http://getcomposer.org) Library Installer |
| 2 | |
| 3 | [](http://travis-ci.org/composer/installers](http://travis-ci.org/composer/installers](http://travis-ci.org/composer/installers) |
| 4 | |
| 5 | This is for PHP package authors to require in their `composer.json`. It will |
| 6 | install their package to the correct location based on the specified package |
| 7 | type. |
| 8 | |
| 9 | The goal of `installers` is to be a simple package type to install path map. |
| 10 | Users can also customize the install path per package and package authors can |
| 11 | modify the package name upon installing. |
| 12 | |
| 13 | `installers` isn't intended on replacing all custom installers. If your |
| 14 | package requires special installation handling then by all means, create a |
| 15 | custom installer to handle it. |
| 16 | |
| 17 | **Natively Supported Frameworks**: |
| 18 | |
| 19 | The following frameworks natively work with Composer and will be |
| 20 | installed to the default `vendor` directory. `composer/installers` |
| 21 | is not needed to install packages with these frameworks: |
| 22 | |
| 23 | * Aura |
| 24 | * Symfony2 |
| 25 | * Yii |
| 26 | |
| 27 | **Current Supported Package Types**: |
| 28 | |
| 29 | > Stable types are marked as **bold**, this means that installation paths |
| 30 | > for those type will not be change. Any adjustment for those types would |
| 31 | > require creation of brand new type that will cover required changes. |
| 32 | |
| 33 | | Framework | Types |
| 34 | | --------- | ----- |
| 35 | | AGL | `agl-module` |
| 36 | | AnnotateCms | `annotatecms-module`<br>`annotatecms-component`<br>`annotatecms-service` |
| 37 | | CakePHP 2+ | **`cakephp-plugin`** |
| 38 | | CodeIgniter | `codeigniter-library`<br>`codeigniter-third-party`<br>`codeigniter-module` |
| 39 | | Croogo | `croogo-plugin`<br>`croogo-theme` |
| 40 | | Drupal | <b>`drupal-module`<br>`drupal-theme`</b><br>`drupal-profile`<br>`drupal-drush` |
| 41 | | FuelPHP v1.x | `fuel-module`<br>`fuel-package` |
| 42 | | Joomla | `joomla-component`<br>`joomla-module`<br>`joomla-template`<br>`joomla-plugin`<br>`joomla-library` |
| 43 | | Kohana | **`kohana-module`** |
| 44 | | Laravel | `laravel-library` |
| 45 | | Lithium | **`lithium-library`<br>`lithium-source`** |
| 46 | | Magento | `magento-library`<br>`magento-skin`<br>`magento-theme` |
| 47 | | Mako | `mako-package` |
| 48 | | MediaWiki | `mediawiki-extension` |
| 49 | | OXID | `oxid-module` |
| 50 | | MODULEWork | `modulework-module` |
| 51 | | phpBB | `phpbb-extension`<br>`phpbb-style`<br>`phpbb-language` |
| 52 | | PPI | **`ppi-module`** |
| 53 | | SilverStripe | `silverstripe-module`<br>`silverstripe-theme` |
| 54 | | symfony1 | **`symfony1-plugin`** |
| 55 | | TYPO3 Flow | `typo3-flow-package`<br>`typo3-flow-framework`<br>`typo3-flow-plugin`<br>`typo3-flow-site`<br>`typo3-flow-boilerplate`<br>`typo3-flow-build` |
| 56 | | TYPO3 CMS | `typo3-cms-extension` |
| 57 | | WordPress | <b>`wordpress-plugin`<br>`wordpress-theme`</b><br>`wordpress-muplugin` |
| 58 | | Zend | `zend-library`<br>`zend-extra` |
| 59 | |
| 60 | ## Example `composer.json` File |
| 61 | |
| 62 | This is an example for a CakePHP plugin. The only important parts to set in your |
| 63 | composer.json file are `"type": "cakephp-plugin"` which describes what your |
| 64 | package is and `"require": { "composer/installers": "~1.0" }` which tells composer |
| 65 | to load the custom installers. |
| 66 | |
| 67 | ```json |
| 68 | { |
| 69 | "name": "you/ftp", |
| 70 | "type": "cakephp-plugin", |
| 71 | "require": { |
| 72 | "composer/installers": "~1.0" |
| 73 | } |
| 74 | } |
| 75 | ``` |
| 76 | |
| 77 | This would install your package to the `Plugin/Ftp/` folder of a CakePHP app |
| 78 | when a user runs `php composer.phar install`. |
| 79 | |
| 80 | So submit your packages to [](http://packagist.orgpackagist.org](http://packagist.org](http://packagist.org)! |
| 81 | |
| 82 | ## Custom Install Paths |
| 83 | |
| 84 | If you are consuming a package that uses the `composer/installers` you can |
| 85 | override the install path with the following extra in your `composer.json`: |
| 86 | |
| 87 | ```json |
| 88 | { |
| 89 | "extra": { |
| 90 | "installer-paths": { |
| 91 | "your/custom/path/{$name}/": ["shama/ftp", "vendor/package"] |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | ``` |
| 96 | |
| 97 | A package type can have a custom installation path with a `type:` prefix. |
| 98 | |
| 99 | ``` json |
| 100 | { |
| 101 | "extra": { |
| 102 | "installer-paths": { |
| 103 | "your/custom/path/{$name}/": ["type:wordpress-plugin"] |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | ``` |
| 108 | |
| 109 | This would use your custom path for each of the listed packages. The available |
| 110 | variables to use in your paths are: `{$name}`, `{$vendor}`, `{$type}`. |
| 111 | |
| 112 | ## Custom Install Names |
| 113 | |
| 114 | If you're a package author and need your package to be named differently when |
| 115 | installed consider using the `installer-name` extra. |
| 116 | |
| 117 | For example you have a package named `shama/cakephp-ftp` with the type |
| 118 | `cakephp-plugin`. Installing with `composer/installers` would install to the |
| 119 | path `Plugin/CakephpFtp`. Due to the strict naming conventions, you as a |
| 120 | package author actually need the package to be named and installed to |
| 121 | `Plugin/Ftp`. Using the following config within your **package** `composer.json` |
| 122 | will allow this: |
| 123 | |
| 124 | ```json |
| 125 | { |
| 126 | "name": "shama/cakephp-ftp", |
| 127 | "type": "cakephp-plugin", |
| 128 | "extra": { |
| 129 | "installer-name": "Ftp" |
| 130 | } |
| 131 | } |
| 132 | ``` |
| 133 | |
| 134 | Please note the name entered into `installer-name` will be the final and will |
| 135 | not be inflected. |
| 136 | |
| 137 | ## Contribute! |
| 138 | |
| 139 | * [](https://help.github.com/articles/fork-a-repoFork and clone](https://help.github.com/articles/fork-a-repo](https://help.github.com/articles/fork-a-repo). |
| 140 | * Run the command `php composer.phar install --dev` to install the dev |
| 141 | dependencies. See [](https://github.com/composer/composer#installation--usageComposer](https://github.com/composer/composer#installation--usage](https://github.com/composer/composer#installation--usage). |
| 142 | * Use the command `phpunit` to run the tests. See [](http://phpunit.dePHPUnit](http://phpunit.de](http://phpunit.de). |
| 143 | * Create a branch, commit, push and send us a |
| 144 | [](https://help.github.com/articles/using-pull-requestspull request](https://help.github.com/articles/using-pull-requests](https://help.github.com/articles/using-pull-requests). |
| 145 | |
| 146 | To ensure a consistent code base, you should make sure the code follows the |
| 147 | [](http://symfony.com/doc/2.0/contributing/code/standards.htmlCoding Standards](http://symfony.com/doc/2.0/contributing/code/standards.html](http://symfony.com/doc/2.0/contributing/code/standards.html) |
| 148 | which we borrowed from Symfony. |
| 149 | |
| 150 | If you would like to help, please take a look at the list of |
| 151 | [](https://github.com/composer/installers/issuesissues](https://github.com/composer/installers/issues](https://github.com/composer/installers/issues). |
| 152 | |
| 153 | ### Should we allow dynamic package types or paths? No. |
| 154 | What are they? The ability for a package author to determine where a package |
| 155 | will be installed either through setting the path directly in their |
| 156 | `composer.json` or through a dynamic package type: `"type": |
| 157 | "framework-install-here"`. |
| 158 | |
| 159 | It has been proposed many times. Even implemented once early on and then |
| 160 | removed. `installers` won't do this because it would allow a single package |
| 161 | author to wipe out entire folders without the user's consent. That user would |
| 162 | then come here to yell at us. |
| 163 |