Composer Installers:一个多框架Composer库安装器

网友投稿 1058 2022-10-25

Composer Installers:一个多框架Composer库安装器

Composer Installers:一个多框架Composer库安装器

A Multi-Framework Composer Library Installer

This is for PHP package authors to require in their composer.json. It will install their package to the correct location based on the specified package type.

The goal of installers is to be a simple package type to install path map. Users can also customize the install path per package and package authors can modify the package name upon installing.

installers isn't intended on replacing all custom installers. If your package requires special installation handling then by all means, create a custom installer to handle it.

Natively Supported Frameworks:

The following frameworks natively work with Composer and will be installed to the default vendor directory. composer/installers is not needed to install packages with these frameworks:

AuraSymfony2YiiYii2

Current Supported Package Types:

Stable types are marked as bold, this means that installation paths for those type will not be changed. Any adjustment for those types would require creation of brand new type that will cover required changes.

FrameworkTypes
Aimeosaimeos-extension
Asgardasgard-module
asgard-theme
Attogramattogram-module
AGLagl-module
Bonefishbonefish-package
AnnotateCmsannotatecms-module
annotatecms-component
annotatecms-service
Bitrixbitrix-module (deprecated)
bitrix-component (deprecated)
bitrix-theme (deprecated)

bitrix-d7-module
bitrix-d7-component
bitrix-d7-template
CakePHP 2+cakephp-plugin
Chefchef-cookbook
chef-role
CCFrameworkccframework-ship
ccframework-theme
Cockpitcockpit-module
CodeIgnitercodeigniter-library
codeigniter-third-party
codeigniter-module
concrete5concrete5-block
concrete5-package
concrete5-theme
concrete5-update
Craftcraft-plugin
Croogocroogo-plugin
croogo-theme
Decibeldecibel-app
DokuWikidokuwiki-plugin
dokuwiki-template
Dolibarrdolibarr-module
Drupaldrupal-core
drupal-module
drupal-theme

drupal-library
drupal-profile
drupal-drush
Elggelgg-plugin
ExpressionEngine 3ee3-addon
ee3-theme
FuelPHP v1.xfuel-module
fuel-package
fuel-theme
FuelPHP v2.xfuelphp-component
Gravgrav-plugin
grav-theme
Huradhurad-plugin
hurad-theme
ImageCMSimagecms-template
imagecms-module
imagecms-library
Joomlajoomla-component
joomla-module
joomla-template
joomla-plugin
joomla-library
Kirbykirby-plugin
kirby-field
kirby-tag
KodiCMSkodicms-plugin
kodicms-media
Kohanakohana-module
Laravellaravel-library
Lithiumlithium-library
lithium-source
Magentomagento-library
magento-skin
magento-theme
Makomako-package
Mauticmautic-plugin
mautic-theme
MODX Evomodxevo-snippet
modxevo-plugin
modxevo-module
modxevo-template
modxevo-lib
MediaWikimediawiki-extension
Octoberoctober-module
october-plugin
october-theme
OXIDoxid-module
oxid-theme
oxid-out
MODULEWorkmodulework-module
Moodlemoodle-* (Please check source for all supported types)
Piwikpiwik-plugin
phpBBphpbb-extension
phpbb-style
phpbb-language
Pimcorepimcore-plugin
Plentymarketsplentymarkets-plugin
PPIppi-module
Puppetpuppet-module
RadPHPradphp-bundle
REDAXOredaxo-addon
ReIndexreindex-plugin
reindex-theme
Roundcuberoundcube-plugin
shopwareshopware-backend-plugin
shopware-core-plugin
shopware-frontend-plugin
shopware-theme
shopware-plugin
shopware-frontend-theme
SilverStripesilverstripe-module
silverstripe-theme
SMFsmf-module
smf-theme
symfony1symfony1-plugin
Tusktusk-task
tusk-command
tusk-asset
TYPO3 Flowtypo3-flow-package
typo3-flow-framework
typo3-flow-plugin
typo3-flow-site
typo3-flow-boilerplate
typo3-flow-build
TYPO3 CMStypo3-cms-extension (Deprecated in this package, use the TYPO3 CMS Installers instead)
Vanillavanilla-plugin
vanilla-theme
Wolf CMSwolfcms-plugin
WordPresswordpress-plugin
wordpress-theme

wordpress-muplugin
YAWIKyawik-module
Zendzend-library
zend-extra
zend-module
Zikulazikula-module
zikula-theme
Prestashopprestashop-module
prestashop-theme
Phiftyphifty-bundle
phifty-framework
phifty-library

Example composer.json File

This is an example for a CakePHP plugin. The only important parts to set in your composer.json file are "type": "cakephp-plugin" which describes what your package is and "require": { "composer/installers": "~1.0" } which tells composer to load the custom installers.

{ "name": "you/ftp", "type": "cakephp-plugin", "require": { "composer/installers": "~1.0" }}

This would install your package to the Plugin/Ftp/ folder of a CakePHP app when a user runs php composer.phar install.

So submit your packages to packagist.org!

Custom Install Paths

If you are consuming a package that uses the composer/installers you can override the install path with the following extra in your composer.json:

{ "extra": { "installer-paths": { "your/custom/path/{$name}/": ["shama/ftp", "vendor/package"] } }}

A package type can have a custom installation path with a type: prefix.

{ "extra": { "installer-paths": { "your/custom/path/{$name}/": ["type:wordpress-plugin"] } }}

You can also have the same vendor packages with a custom installation path by using the vendor: prefix.

{ "extra": { "installer-paths": { "your/custom/path/{$name}/": ["vendor:my_organization"] } }}

These would use your custom path for each of the listed packages. The available variables to use in your paths are: {$name}, {$vendor}, {$type}.

Custom Install Names

If you're a package author and need your package to be named differently when installed consider using the installer-name extra.

For example you have a package named shama/cakephp-ftp with the type cakephp-plugin. Installing with composer/installers would install to the path Plugin/CakephpFtp. Due to the strict naming conventions, you as a package author actually need the package to be named and installed to Plugin/Ftp. Using the following config within your package composer.json will allow this:

{ "name": "shama/cakephp-ftp", "type": "cakephp-plugin", "extra": { "installer-name": "Ftp" }}

Please note the name entered into installer-name will be the final and will not be inflected.

Contribute!

Fork and clone.Run the command php composer.phar install to install the dependencies. This will also install the dev dependencies. See Composer.Use the command phpunit to run the tests. See PHPUnit.Create a branch, commit, push and send us a pull request.

To ensure a consistent code base, you should make sure the code follows the Coding Standards which we borrowed from Symfony.

If you would like to help, please take a look at the list of issues.

Should we allow dynamic package types or paths? No.

What are they? The ability for a package author to determine where a package will be installed either through setting the path directly in their composer.json or through a dynamic package type: "type": "framework-install-here".

It has been proposed many times. Even implemented once early on and then removed. installers won't do this because it would allow a single package author to wipe out entire folders without the user's consent. That user would then come here to yell at us.

Anyone still wanting this capability should consider requiring https://github.com/oomphinc/composer-installers-extender.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:使用NCNN框架在Android上实现YOLOv5 C++
下一篇:SpringBoot实现多数据源的切换实践
相关文章

 发表评论

暂时没有评论,来抢沙发吧~