skynet / installers
多框架 Composer 库安装器
Requires
- php: >=8.1
- composer-plugin-api: ^1.0 || ^2.0
- hflabs/dadata: *
- html2text/html2text: ^4.3
- irazasyed/telegram-bot-sdk: 3.x-dev
- kub-at/php-simple-html-dom-parser: dev-master
- mobiledetect/mobiledetectlib: ^3.74.0
- neos/diff: ^8.3
- nette/utils: ^4.0
- respect/rest: 0.6.1
- spatie/array-to-xml: dev-main
Requires (Dev)
- composer/composer: *@dev
- phpunit/phpunit: 4.1.*
Replaces
- roundcube/plugin-installer: *
- shama/baton: *
This package is auto-updated.
Last update: 2024-09-23 18:47:07 UTC
README
此工具供 PHP 包作者在他们的 composer.json 中使用。它将根据指定的包类型将包安装到正确的位置。
Installers 的目标是成为一个简单的包类型到安装路径映射。用户也可以根据每个包自定义安装路径,包作者可以在安装时修改包名。
Installers 并不打算取代所有自定义安装器。如果您的包需要特殊安装处理,则请创建一个自定义安装器来处理。
原生支持框架:
以下框架与 Composer 原生兼容,并将安装到默认的 vendor 目录。安装这些框架的包不需要 composer/installers
- Aura
- Symfony2
- Yii
- Yii2
当前支持的包类型
稳定的类型用粗体表示,这意味着这些类型的安装路径将不会更改。对这些类型的任何调整都需要创建全新的类型以涵盖所需的变化。
| 框架 | 类型 |
|---|---|
| Aimeos | aimeos-extension |
| Asgard | asgard-moduleasgard-theme |
| Attogram | attogram-module |
| AGL | agl-module |
| Bonefish | bonefish-package |
| AnnotateCms | annotatecms-moduleannotatecms-componentannotatecms-service |
| Bitrix | bitrix-module (已弃用)bitrix-component (已弃用)bitrix-theme (已弃用)bitrix-d7-module bitrix-d7-component bitrix-d7-template |
| CakePHP 2+ | cakephp-plugin |
| Chef | chef-cookbookchef-role |
| CCFramework | ccframework-shipccframework-theme |
| Cockpit | cockpit-module |
| CodeIgniter | codeigniter-librarycodeigniter-third-partycodeigniter-module |
| concrete5 | concrete5-coreconcrete5-packageconcrete5-themeconcrete5-blockconcrete5-update |
| Craft | craft-plugin |
| Croogo | croogo-plugincroogo-theme |
| Decibel | decibel-app |
| DokuWiki | dokuwiki-plugindokuwiki-template |
| Dolibarr | dolibarr-module |
| Drupal | drupal-coredrupal-moduledrupal-themedrupal-librarydrupal-profiledrupal-drush |
| Elgg | elgg-plugin |
| Eliasis | eliasis-module |
| ExpressionEngine 3 | ee3-addonee3-theme |
| eZ Platform | ezplatform-assetsezplatform-meta-assets |
| FuelPHP v1.x | fuel-modulefuel-package<br/>fuel-theme |
| FuelPHP v2.x | fuelphp-component |
| Grav | grav-plugingrav-theme |
| Hurad | hurad-pluginhurad-theme |
| ImageCMS | imagecms-templateimagecms-moduleimagecms-library |
| iTop | itop-extension |
| Joomla | joomla-componentjoomla-modulejoomla-templatejoomla-pluginjoomla-library |
| Kanboard | kanboard-plugin |
| Kirby | kirby-pluginkirby-fieldkirby-tag |
| KodiCMS | kodicms-pluginkodicms-media |
| Kohana | kohana-module |
| Lan Management System | lms-pluginlms-templatelms-document-templatelms-userpanel-module |
| Laravel | laravel-library |
| Lavalite | lavalite-themelavalite-package |
| Lithium | lithium-librarylithium-source |
| Magento | magento-librarymagento-skinmagento-theme |
| Mako | mako-package |
| Mautic | mautic-pluginmautic-theme |
| Maya | maya-module |
| MODX Evo | modxevo-snippetmodxevo-pluginmodxevo-modulemodxevo-templatemodxevo-lib |
| MediaWiki | mediawiki-extension |
| October | october-moduleoctober-pluginoctober-theme |
| OntoWiki | ontowiki-extensionontowiki-themeontowiki-translation |
| OXID | oxid-moduleoxid-themeoxid-out |
| Osclass | osclass-pluginosclass-themeosclass-language |
| MODULEWork | modulework-module |
| Moodle | moodle-*(请检查源代码以获取所有受支持类型) |
| Piwik | piwik-plugin |
| phpBB | phpbb-extensionphpbb-stylephpbb-language |
| Pimcore | pimcore-plugin |
| Plentymarkets | plentymarkets-plugin |
| PPI | ppi-module |
| Puppet | puppet-module |
| Porto | porto-container |
| RadPHP | radphp-bundle |
| REDAXO | redaxo-addon |
| ReIndex | reindex-plugin reindex-theme |
| Roundcube | roundcube-plugin |
| shopware | shopware-backend-plugin<br/>shopware-core-plugin<br/>shopware-frontend-plugin<br/>shopware-theme<br/>shopware-plugin<br/>shopware-frontend-theme |
| SilverStripe | silverstripe-modulesilverstripe-theme |
| SMF | smf-modulesmf-theme |
| SyDES | sydes-modulesydes-theme |
| symfony1 | symfony1-plugin |
| Tusk | tusk-tasktusk-commandtusk-asset |
| TYPO3 Flow | typo3-flow-packagetypo3-flow-frameworktypo3-flow-plugintypo3-flow-sitetypo3-flow-boilerplatetypo3-flow-build |
| TYPO3 CMS | typo3-cms-extension(在此包中已弃用,请使用TYPO3 CMS Installers替代) |
| UserFrosting | userfrosting-sprinkle |
| Vanilla | vanilla-pluginvanilla-theme |
| Vgmcp | vgmcp-bundlevgmcp-theme |
| Wolf CMS | wolfcms-plugin |
| WordPress | wordpress-pluginwordpress-themewordpress-muplugin |
| YAWIK | yawik-module |
| Zend | zend-libraryzend-extrazend-module |
| Zikula | zikula-modulezikula-theme |
| Prestashop | prestashop-moduleprestashop-theme |
| Phifty | phifty-bundlephifty-frameworkphifty-library |
示例 composer.json 文件
这是一个 CakePHP 插件的示例。在您的 composer.json 文件中需要设置的仅有的重要部分是 "type": "cakephp-plugin",它描述了您的包是什么,以及 "require": { "composer/installers": "~1.0" },它告诉 composer 加载自定义安装程序。
{
"name": "you/ftp",
"type": "cakephp-plugin",
"require": {
"composer/installers": "~1.0"
}
}
当用户运行 php composer.phar install 时,这将在 CakePHP 应用的 Plugin/Ftp/ 文件夹中安装您的包。
因此,将您的包提交到 packagist.org!
自定义安装路径
如果您正在使用 composer/installers 消费包,您可以使用以下 composer.json 中的额外选项覆盖安装路径
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["shama/ftp", "vendor/package"]
}
}
}
包类型可以具有自定义安装路径,以 type: 前缀开头。
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["type:wordpress-plugin"]
}
}
}
您还可以使用 vendor: 前缀具有相同供应商包的自定义安装路径。
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["vendor:my_organization"]
}
}
}
这些将使用您的自定义路径为列出的每个包。您可以在路径中使用以下变量:{$name}、{$vendor}、{$type}。
自定义安装名称
如果您是包作者,并且需要您的包在安装时使用不同的名称,请考虑使用 installer-name 额外选项。
例如,您有一个名为 shama/cakephp-ftp 的软件包,其类型为 cakephp-plugin。使用 composer/installers 安装将会安装到路径 Plugin/CakephpFtp。由于严格的命名约定,您作为软件包作者实际上需要软件包命名为并安装到 Plugin/Ftp。在您的 软件包 的 composer.json 中使用以下配置将允许这样做
{
"name": "shama/cakephp-ftp",
"type": "cakephp-plugin",
"extra": {
"installer-name": "Ftp"
}
}
请注意,输入到 installer-name 的名称将是最终的,并且不会被变形。
我们是否应该允许动态软件包类型或路径?不。
它们是什么?允许软件包作者通过在他们的 composer.json 中直接设置路径或通过动态软件包类型:"type": "framework-install-here" 来确定软件包将被安装的位置。
这已经被多次提议。甚至在早期实施过一次,然后被移除。安装器不会这样做,因为这将允许单个软件包作者在未经用户同意的情况下清除整个文件夹。然后那个用户会来这里向我们大喊。
任何仍然想要这个功能的人应该考虑要求 https://github.com/oomphinc/composer-installers-extender。