0

symfony official documentation lacks good info about developing sharable bundles and I couldn't find any information on the Internet either. Here are my questions:

  1. Currently I've created my bundle with SensioGeneratorBundle and it lives in /src/, other third party bundles installed with composer live in /vendor/, how can I develop and use my bundle at the same time? I don't want to do git push and pulls on every update. Should I create symlink from /vendor/ to my bundle or something? I've tried this, but the autoloder doesn't work and AppKernel.php can't find my bundle?
  2. I want to use third party library (not symfony bundle) in my symfony bundle, how can I do this? I've tried to add /vendor/ folder inside my bundle and install libraries there, but the autoloader can't find them.

Thanks.

nacholibre
  • 3,874
  • 3
  • 32
  • 35
  • 1
    Yes while in development you can symlink it. Later it should be included in your applications via `composer install` – Xatenev May 31 '16 at 09:16
  • app/autoload.php would allow adding a path to your bundle without using links. What you really need to do is to read and understand the composer documentation. – Cerad May 31 '16 at 09:43

2 Answers2

3

One of possible solutions is fork your bundle on Github and add it in composer. There is the example using SonataAdminBundle:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/<your-github-username>/SonataAdminBundle"
    }
  ],
  "require": {
    "sonata-project/admin-bundle": "2.x",
  }
}

Now you can develop your bundle in /vendor/sonata-project/admin-bundle/ and push your changes in own repository.

Third party libraries also can be included in composer and they will be in vendor library.

Artem Zhuravlev
  • 788
  • 6
  • 12
1

You could also try to add the bundle to .gitignore that way the bundle would not be pushed to the repository .

Favian Ioel P
  • 312
  • 3
  • 13