简体   繁体   中英

Develop a third-party bundle (or library) in local

I want to develop a public and third-party bundle for Symfony. To test the bundle during the development, I need a functional Symfony installation. So I need to mimic a Composer installation of my bundle in the Symfony test application.

The problem is, what is the best way to achieve that ? It would be wonderful if composer could just let us define a local repository, and without the need to commit on the package side then do the composer update on the Symfony app side each time you want to test the bundle . The solution I'm explaining here is explained here : http://tech.vg.no/2014/11/25/using-local-packages-as-composer-dependencies/

This is the best solution I have found for now and I don't see a lot of literature about that. So this is a call to "Symfony 3rd-party bundles developers": how do you develop and test your bundles during the development?

Just to clarify my comment about app/autoload.php, Symfony 2 gives you a little hook to allow customizing the autoload process:

// app/autoload.php
$loader = require __DIR__.'/../vendor/autoload.php';
$loader->add('Cerad',   __DIR__  . '/../../cerad2/src');
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;

So in the above case the cerad2 library located somewhere else on the file system will be used.

Is this better than simply adjusting the test app's composer file? Probably not though it does come in handy. Use whichever approach works best for you.

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