38

So my question is how to delete bundle I created?

You create bundles with this console command:

php app/console generate:bundle --namespace=Test/BlogBundle --format=yml

And thats awsome but what if I need to delete this bundle? Is there a console command to delete a bundle I dont need any more?

I know that when you create new bundle from console, you:

1. create /src/Test/BlogBundle directory
2. change /app/config/routing.yml file to include routes
3. include your new bundle in /app/Resources/App.Kernel.php
4. I think there is something changed in /app/cache/...

Now what would be correct way of deleting a bundle completely?

Its joust that using console these bundles are generated "magically" so I dont know what did this command changed in folder structure and files?

Elnur Abdurrakhimov
  • 44,533
  • 10
  • 148
  • 133
Limeni
  • 4,954
  • 8
  • 31
  • 33

3 Answers3

64

It is basically the process you have outlined, only in somewhat different order.

  1. delete /src/Test/BlogBundle directory
  2. change /app/config/routing.yml file to remove the bundle routes
  3. remove your new bundle from /app/AppKernel.php
  4. clear cache (either by deleting cache/{$env} or console cache:clear)

If this wasn't installed using a dependency manager - that should be all.

GregPK
  • 1,232
  • 11
  • 17
6

I know I am late to answer this but Symfony has instructions on how to delete the bundle. This is how I delete. You can use the same instructions for other bundles you created and want to remove now.

Shairyar
  • 3,268
  • 7
  • 46
  • 86
0

To delete a bundle in Symfony 3 (and higher) :

Method 1 :

  1. go to composer.json, search & delete the bundle.
  2. run composer update ( it will automatically remove the bundle and clear the cache)

Method 2 :
run composer remove alias/to/your/bundle
f.e : composer remove nesbot/carbon

That's all.

Hicham O-Sfh
  • 731
  • 10
  • 12