skynet/installers

多框架 Composer 库安装器

安装: 297

依赖者: 2

建议者: 0

安全: 0

星标: 0

分支: 0

类型:composer-plugin


README

Build Status

此工具供 PHP 包作者在他们的 composer.json 中使用。它将根据指定的包类型将包安装到正确的位置。

Installers 的目标是成为一个简单的包类型到安装路径映射。用户也可以根据每个包自定义安装路径,包作者可以在安装时修改包名。

Installers 并不打算取代所有自定义安装器。如果您的包需要特殊安装处理,则请创建一个自定义安装器来处理。

原生支持框架:

以下框架与 Composer 原生兼容,并将安装到默认的 vendor 目录。安装这些框架的包不需要 composer/installers

  • Aura
  • Symfony2
  • Yii
  • Yii2

当前支持的包类型

稳定的类型用粗体表示,这意味着这些类型的安装路径将不会更改。对这些类型的任何调整都需要创建全新的类型以涵盖所需的变化。

框架类型
Aimeosaimeos-extension
Asgardasgard-module
asgard-theme
Attogramattogram-module
AGLagl-module
Bonefishbonefish-package
AnnotateCmsannotatecms-module
annotatecms-component
annotatecms-service
Bitrixbitrix-module (已弃用)
bitrix-component (已弃用)
bitrix-theme (已弃用)

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-core
concrete5-package
concrete5-theme
concrete5-block
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
Eliasiseliasis-module
ExpressionEngine 3ee3-addon
ee3-theme
eZ Platformezplatform-assets
ezplatform-meta-assets
FuelPHP v1.xfuel-module
fuel-package<br/>fuel-theme
FuelPHP v2.xfuelphp-component
Gravgrav-plugin
grav-theme
Huradhurad-plugin
hurad-theme
ImageCMSimagecms-template
imagecms-module
imagecms-library
iTopitop-extension
Joomlajoomla-component
joomla-module
joomla-template
joomla-plugin
joomla-library
Kanboardkanboard-plugin
Kirbykirby-plugin
kirby-field
kirby-tag
KodiCMSkodicms-plugin
kodicms-media
Kohanakohana-module
Lan Management Systemlms-plugin
lms-template
lms-document-template
lms-userpanel-module
Laravellaravel-library
Lavalitelavalite-theme
lavalite-package
Lithiumlithium-library
lithium-source
Magentomagento-library
magento-skin
magento-theme
Makomako-package
Mauticmautic-plugin
mautic-theme
Mayamaya-module
MODX Evomodxevo-snippet
modxevo-plugin
modxevo-module
modxevo-template
modxevo-lib
MediaWikimediawiki-extension
Octoberoctober-module
october-plugin
october-theme
OntoWikiontowiki-extension
ontowiki-theme
ontowiki-translation
OXIDoxid-module
oxid-theme
oxid-out
Osclassosclass-plugin
osclass-theme
osclass-language
MODULEWorkmodulework-module
Moodlemoodle-*(请检查源代码以获取所有受支持类型)
Piwikpiwik-plugin
phpBBphpbb-extension
phpbb-style
phpbb-language
Pimcorepimcore-plugin
Plentymarketsplentymarkets-plugin
PPIppi-module
Puppetpuppet-module
Portoporto-container
RadPHPradphp-bundle
REDAXOredaxo-addon
ReIndexreindex-plugin
reindex-theme
Roundcuberoundcube-plugin
shopwareshopware-backend-plugin<br/>shopware-core-plugin<br/>shopware-frontend-plugin<br/>shopware-theme<br/>shopware-plugin<br/>shopware-frontend-theme
SilverStripesilverstripe-module
silverstripe-theme
SMFsmf-module
smf-theme
SyDESsydes-module
sydes-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(在此包中已弃用,请使用TYPO3 CMS Installers替代)
UserFrostinguserfrosting-sprinkle
Vanillavanilla-plugin
vanilla-theme
Vgmcpvgmcp-bundle
vgmcp-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

示例 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