In
Symfony3
When performing
php bin/console generate:bundle
When the bundle is created, the console asks if it will share the bundle that will be created in the future.
If selected no
, the bundle is created after the catalog as src/UserBundle
, if selected yes
, you need to add vendor name, after creating assrc/XX/UserBundle
However, there may not be a shared plan during creation, so if you have plans to share later, you will need to reorganize the files namespace
and the corresponding profiles.
Should you always include vendor name when the bundle is created?
Like src/XX/UserBundle
or src/XX/Bundle/UserBundle
The side effect is that when you are not ready to share the current bundle, you have one more in the application source code namespace
. or service
the definition and route
when a prefix is more, such asxx_user.user_manager
This frees you from worrying about the need to change the directory structure, namespace, and namespace issues for route and service when sharing the current bundle later.
Do you have any idea?
Reply content:
When Symfony3
executing the php bin/console generate:bundle
create bundle, the console will ask if it will share the bundle that will be created in the future.
If selected no
, the bundle is created after the catalog as src/UserBundle
, if selected yes
, you need to add vendor name, after creating assrc/XX/UserBundle
However, there may not be a shared plan during creation, so if you have plans to share later, you will need to reorganize the files namespace
and the corresponding profiles.
Should you always include vendor name when the bundle is created?
Like src/XX/UserBundle
or src/XX/Bundle/UserBundle
The side effect is that when you are not ready to share the current bundle, you have one more in the application source code namespace
. or service
the definition and route
when a prefix is more, such asxx_user.user_manager
This frees you from worrying about the need to change the directory structure, namespace, and namespace issues for route and service when sharing the current bundle later.
Do you have any idea?
Why are you vendorname?
VendorName is to avoid different Vendor of the same bundlename conflict, simply to avoid naming conflicts, such as Foo and Bar two Vendor to create a userbundle, then can not add vendorname will produce Is it not difficult to understand the conflict?
Under what circumstances should VendorName be included?
If your bundle is used only in the current project, not as a shared third-party bundle (which typically needs to be published as a composer package), then you don't need to vendorname, but you need to add vendername instead.