अपने बंडल में एक composer.json फ़ाइल जोड़ें। उदाहरण के लिए मैं अपने बंडलों में से एक के लिए इस है:
{
"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 करने के लिए अपने समूह को जोड़। यह बहुत आसान है, मूल रूप से आपको बस अपना गिट पता देना होगा और यह बाकी करेगा।
एक बार आपका बंडल पैकेजिस्ट में उपलब्ध हो जाने के बाद, बस इसे अपने सिम्फनी प्रोजेक्ट के लिए composer.json फ़ाइल में निर्भरता के रूप में जोड़ें। मेरे मामले में मेरे पास है:
"require": {
....
"cg/kint-bundle": "*"
},
फिर बस अपनी सिम्फनी निर्देशिका में "संगीतकार अद्यतन" चलाएं और यह सब कुछ है! आपको ऑटोलोड फ़ाइल को अपडेट करने की भी आवश्यकता नहीं है, संगीतकार आपके लिए यह करेगा। केवल एक चीज छोड़कर appkernel.php
स्रोत
2012-08-22 16:03:20
** Symfony 2.1 के साथ आप भी पुराने निर्भरता प्रबंधक का उपयोग कर सकते हैं! ** आप संगीतकार अपने निर्भरता हैं क्या बताने के लिए एक 'composer.json' फ़ाइल बनाने के लिए किया है। आपको [सिम्फनी मानक संस्करण का एक] देखना चाहिए (https://github.com/symfony/symfony-standard/blob/master/composer.json)। फिर अपने बंडल के लिए एक और 'composer.json' बनाएं। – Florent
@ फ्लोरेंट, कृपया ध्यान रखें कि कंपोज़र टूल, 'संगीतकार-php' के लिए पहले से ही एक टैग है। – Charles