composer.json ファイルをバンドルに追加します。たとえば、バンドルの 1 つにこれがあります。
{
"name": "cg/kint-bundle",
"type": "symfony-bundle",
"description": "This bundle lets you use the Kint function in your Twig templates. Kint is a print_r() replacement which produces a structured, collapsible and escaped output",
"keywords": ["kint", "debug", "symfony", "bundle", "twig"],
"homepage": "http://github.com/barelon/CgKintBundle",
"license": "MIT",
"authors": [
{
"name": "Carlos Granados",
"homepage": "http://github.com/barelon"
},
{
"name": "Symfony Community",
"homepage": "http://github.com/barelon/CgKintBundle"
}
],
"require": {
"php": ">=5.3.2",
"symfony/framework-bundle": ">=2.0.0",
"raveren/kint": "dev-master"
},
"minimum-stability": "dev",
"autoload": {
"psr-0": {
"Cg\\KintBundle": ""
}
},
"target-dir": "Cg/KintBundle"
}
次に、バンドルをpackagist.orgに追加します。それは非常に簡単です。基本的には、git アドレスを指定するだけで、あとは自動で実行されます。
バンドルが packagist で利用可能になったら、symfony プロジェクトの composer.json ファイルに依存関係として追加します。私の場合、私は持っています:
"require": {
....
"cg/kint-bundle": "*"
},
次に、symfony ディレクトリで「composer update」を実行するだけです。autoload ファイルを更新する必要さえありません。composer が更新してくれます。あとは appkernel.php にバンドルをロードするだけです