简体   繁体   中英

Handling separate Bundle Requirements on Symfony2

I'm trying to develop a re-usable bundle for Symfony, but I'm stuck, as I don't understand how to migrate from the bundle itself for a package.

I've found this very usefull tutorial:

http://knpuniversity.com/screencast/question-answer-day/create-composer-package

But unfortunately, it's only usefull when you already have your library finished.

What I would like to do is being able to, for example, create a new symfony bundle in a project, and to define what dependencies that bundle have, let's say at a composer.json file under the root of that bundle (and not the whole project) and, when doing composer update at the root of my project, it automatically handles the deps for the bundle AND the rest of the project.

Then, when I see that the bundle is fully functional, I would then, of course, upload it to github and packagist and, therefore, the tutorial would be useful.

Has anyone deal with this kind of issues?

Thanks a lot in advance!

You can use a local repository as a requirement for your app:

"repositories": [
    {
        "type":"vcs",
        "url":"/home/marek/dev/sf2-bundles/TheodoRogerCmsBundle"
    }
],
"require":{
     "theodo/roger-cms-bundle":"dev-master"
}

Source: http://marekkalnik.tumblr.com/post/22929686367/composer-installing-package-from-local-git-repository

Then you can put it anywhere you prefer and Composer will fetch it for your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM