lighty/installers

多框架Composer库安装器

安装: 36

依赖: 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
AGLagl-module
Bonefishbonefish-package
AnnotateCmsannotatecms-module
annotatecms-component
annotatecms-service
Bitrixbitrix-module
bitrix-component
bitrix-theme
CakePHP 2+cakephp-plugin
Chefchef-cookbook
chef-role
CCFrameworkccframework-ship
ccframework-theme
CodeIgnitercodeigniter-library
codeigniter-third-party
codeigniter-module
concrete5concrete5-block
concrete5-package
concrete5-theme
concrete5-update
Craftcraft-plugin
Croogocroogo-plugin
croogo-theme
DokuWikidokuwiki-plugin
dokuwiki-template
Dolibarrdolibarr-module
Drupaldrupal-core
drupal-module
drupal-theme

drupal-library
drupal-profile
drupal-drush
Elggelgg-plugin
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
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
MODULEWork模块工作模块
Moodlemoodle-* (请检查源代码以获取所有支持的类型)
Pikiapikia-plugin
pikia-docs
Piwikpiwik-plugin
phpBBphpbb-extension
phpbb-style
phpbb-language
Pimcorepimcore-plugin
PPIppi-module
Puppetpuppet-module
RadPHPradphp-bundle
REDAXOredaxo-addon
Roundcuberoundcube-plugin
shopwareshopware-backend-plugin<br/>shopware-core-plugin<br/>shopware-frontend-plugin<br/>shopware-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 (本包中已弃用,请使用TYPO3 CMS Installers替代)
Wolf CMSwolfcms-plugin
WordPresswordpress-plugin
wordpress-theme

wordpress-muplugin
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。使用以下配置在您的package composer.json中可以实现这一点

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

请注意,输入到installer-name中的名称将是最终的并且不会被变形。

贡献!

  • 分叉和克隆.
  • 运行命令php composer.phar install以安装依赖项。这将也会安装开发依赖项。请参阅Composer
  • 使用命令phpunit运行测试。请参阅PHPUnit
  • 创建一个分支,提交,推送到我们的仓库,并给我们发送一个拉取请求

为了确保代码库的一致性,您应该确保代码遵循我们借鉴自Symfony的编码规范

如果您想帮忙,请查看问题列表

我们应该允许动态包类型或路径吗?不。

这是什么?允许包作者通过在他们的composer.json中直接设置路径,或者通过动态包类型:"type": "framework-install-here"来确定包的安装位置。

这被提出过很多次。甚至在早期实现过一次,然后又移除。因为installers不会这样做,因为这会允许单个包作者在没有用户同意的情况下清除整个文件夹。然后那个用户会来这里骂我们。

任何仍然想要这个功能的人应该考虑要求https://github.com/oomphinc/composer-installers-extender