0
votes

In practicing with Symfony 4.1 I noticed how it says on the bundles page: (https://symfony.com/doc/current/bundles.html)

In Symfony versions prior to 4.0, it was recommended to organize your own application code using bundles. This is no longer recommended and bundles should only be used to share code and features between multiple applications.

Why is that and what is to replace bundles? Simply create directories inside one "App" bundle?

So a mere subfolder replaces a bundle?

2
Up until S4 you need at least one AppBundle in order to take full advantage of Symfony's configuration. Thanks to some fairly minor tweaks you can now do most of your configuration without a bundle. In general you would still have an App namespace but your classes would live directly under the src directory. Look at the demo app for a complete example.Cerad

2 Answers

4
votes

The answer to your question is written at the bottom of this page here on symfony site. To Summarize

But a bundle is meant to be something that can be reused as a stand-alone piece of software. If UserBundle cannot be used "as is" in other Symfony apps, then it shouldn't be its own bundle. Moreover, if InvoiceBundle depends on ProductBundle, then there's no advantage to having two separate bundles.

and then

Don't create any bundle to organize your application logic.

Symfony applications can still use third-party bundles (installed in vendor/) to add features, but you should use PHP namespaces instead of bundles to organize your own code.

So to Answer your question "So a mere subfolder replaces a bundle?" Yes! if its a reusable piece of code that can be used by other applications make it into a bundle otherwise if its just there to organize the application, use folders (with namespaces) for that.

0
votes