-
Notifications
You must be signed in to change notification settings - Fork 710
Composer 2.0 導入に伴うプラグインの composer.json の変更 #4737
Copy link
Copy link
Closed
Labels
dependenciesPull requests that update a dependency filePull requests that update a dependency filedocumentImprovements or additions to documentationImprovements or additions to documentation
Milestone
Description
Composer 2.0 関連の issues がいくつかありますが、 プラグイン側で必ず必要 な変更点をまとめておきます
概要(Overview)
EC-CUBE4.0.x(Composer1.x) のみに対応するプラグイン
composer.json の例
{
"name": "ec-cube/ExamplePlugin",
"version": "1.0.0",
"description": "プラグインのサンプル",
"type": "eccube-plugin",
"require": {
"ec-cube/plugin-installer": "~0.0.6"
},
"extra": {
"code": "ExamplePlugin"
}
}name
ec-cube/<PluginCode>
PluginCode はプラグインの namespace に対応する必要があります。
<?php
namespace Plugin\ExamplePlugin;
// 上記の namespace の場合、 composer.json の name は ec-cube/ExamplePlugin になります。require
ec-cube/plugin-installer: "~0.0.6" を含める必要があります (#4734)
EC-CUBE4.1.x(Composer2.x) のみに対応するプラグイン
composer.json の例
{
"name": "ec-cube/exampleplugin",
"version": "2.0.0",
"description": "プラグインのサンプル",
"type": "eccube-plugin",
"extra": {
"code": "ExamplePlugin"
}
}name
ec-cube/<すべて小文字のPluginCode>
PluginCode はプラグインの namespace に対応し、すべて小文字にする必要があります。
<?php
namespace Plugin\ExamplePlugin;
// 上記の namespace の場合、 composer.json の name は ec-cube/exampleplugin になります。require
ec-cube/plugin-installer への依存関係の設定は、EC-CUBE本体に設定されているため、基本的に不要。
明示的にバージョンを指定したい場合のみ、ec-cube/plugin-installer への依存関係を記述します。
// 明示的にバージョン設定する例
"require": {
"ec-cube/plugin-installer": "^2.0"
}EC-CUBE4.0.x(Composer1.x) 及び EC-CUBE4.1.x(Composer2.x)の両方に対応するプラグイン
composer.json の例
{
"name": "ec-cube/exampleplugin",
"version": "2.0.0",
"description": "プラグインのサンプル",
"type": "eccube-plugin",
"require": {
"ec-cube/plugin-installer": "~0.0.6 || ^2.0"
},
"extra": {
"code": "ExamplePlugin"
}
}name
ec-cube/<すべて小文字のPluginCode>
PluginCode はプラグインの namespace に対応し、すべて小文字にする必要があります。
<?php
namespace Plugin\ExamplePlugin;
// 上記の namespace の場合、 composer.json の name は ec-cube/exampleplugin になります。require
ec-cube/plugin-installer: "~0.0.6 || ^2.0" を含める必要があります
"require": {
"ec-cube/plugin-installer": "~0.0.6 || ^2.0"
},その他(Other)
- name をすべて小文字に対応するため、package-api 側の改修が必要
- package-api 側で、 composer.json を上記ルールで自動変換できれば、 4.0.x にも Composer2.0 をバックポートできる可能性あり
関連情報 (Ref)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
dependenciesPull requests that update a dependency filePull requests that update a dependency filedocumentImprovements or additions to documentationImprovements or additions to documentation