2012-08-22 21 views
6

मैं अभी सिम्फनी 2.1 में स्थानांतरित हो गया हूं, और मैं समझ नहीं पा रहा हूं, मैं संगीतकार के साथ अपने स्वयं के बंडल कैसे स्थापित कर सकता हूं? उसके बाद मैं सिर्फ bin/vendors update शुरू हो रहासिम्फनी 2.1 में संगीतकार के साथ अपना स्वयं का बंडल कैसे इंस्टॉल करें?

[MyOwnBundle] 
    [email protected]:weboshin_cms_bundle.git 
    target=/bundles/My/OwnBundle 

और है कि यह था:

यह deps में 2.0.x में बहुत आसान था!

लेकिन अब deps फ़ाइल नहीं है, और मुझे संगीतकार के साथ सब कुछ करना है। कृपया मुझे कोई संकेत दें।

+0

** Symfony 2.1 के साथ आप भी पुराने निर्भरता प्रबंधक का उपयोग कर सकते हैं! ** आप संगीतकार अपने निर्भरता हैं क्या बताने के लिए एक 'composer.json' फ़ाइल बनाने के लिए किया है। आपको [सिम्फनी मानक संस्करण का एक] देखना चाहिए (https://github.com/symfony/symfony-standard/blob/master/composer.json)। फिर अपने बंडल के लिए एक और 'composer.json' बनाएं। – Florent

+0

@ फ्लोरेंट, कृपया ध्यान रखें कि कंपोज़र टूल, 'संगीतकार-php' के लिए पहले से ही एक टैग है। – Charles

उत्तर

6

में बंडल लोड करना होगा। मुझे जवाब मिल गया है।

// my_project/compose.json: 
{ 
    "repositories": [ 
     { 
      "type": "vcs", 
      "url": "own_repository_url" 
     } 
    ], 

    // ... 

    "require": { 
     // ... 
     "own/bundle": "dev-master" 
    } 
}, 

// own_repository/own_bundle/compose.json: 
{ 
    "name": "own/bundle" 
} 
5

अपने बंडल में एक 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

+3

ध्यान दें कि "पैकगिस्ट में जोड़ना" केवल बंद स्रोतों के लिए ओपन सोर्स बंडलों के लिए मान्य है, https://getcomposer.org/doc/05-repositories.md#vcs और https://getcomposer.org/doc देखें /articles/handling-private-packages-with-satis.md – Seldaek

+6

क्या किसी को पता है कि 'सिम्फनी-बंडल' का क्या अर्थ है? इस प्रकार का उपयोग करने के क्या परिणाम हैं? – greg0ire

संबंधित मुद्दे