Answer the question
In order to leave comments, you need to log in
Symfony 4 - Best Practices for Reusable Bundles what is the point and how to create a bundle anyway?
Hello everyone,
I didn't quite understand the documentation. why now symphony does not advise creating bundles?
or create bundles somehow in a special way?
in the src folder is no longer possible so where then in the root of the project?
thanks in advance to all
Answer the question
In order to leave comments, you need to log in
Obviously you are referring to this article in the Symfony documentation.
If you read the text more carefully, it doesn't say that bundles are now banned or discouraged. We are talking about the fact that bundles should be used if you want to arrange part of your code in a separate package that can be used in other projects. The main application should no longer be designed as a bundle, but can be written directly. It is proposed not to put in /src
a bunch of different bundles, but to have one common application code that depends only on external packages (even if written by you) that are installed via Composer.
Those. for example, a Sylius-like code structure is no longer considered good practice.
I think that one of the reasons for this change is the transition to Symfony Flex and automated support for registering / configuring bundles via recipes .
make stateless bundles and connect via composer as a vendor
, the topic is generally deeper, but you can still keep part of the logic ported directly to src (at the level of folders / namespaces), it’s just that left dependencies are often quickly removed there and in order not to flatter ourselves, it’s not worth it call it a bundle (hence the bundle-less approach appeared)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question