In Symfony3
When executing php bin/console generate:bundle
to create a bundle, the console will ask whether the bundle to be created will be shared in the future.
If you choose no
, the directory after bundle creation will be like src/UserBundle
. If you choose yes
, you need to add vendor name. After creation, the directory will be like src/XX/UserBundle
However, there may be no sharing plan during creation. If you plan to share in the future, you need to reorganize the file namespace
and the corresponding configuration file.
So should vendor name always be included when bundle is created?
For example src/XX/UserBundle
or src/XX/Bundle/UserBundle
The side effect of this is that when you are not going to share the current bundle, you have an extra namespace
in the application source code. Or there is an extra prefix when defining service
and route
, such as xx_user.user_manager
This eliminates the need to worry about changing the directory structure, namespace, route and service namespace issues when sharing the current bundle in the future.
What do you think?
Reply content:
In Symfony3
When executing php bin/console generate:bundle
to create a bundle, the console will ask whether the bundle to be created will be shared in the future.
If you choose no
, the directory after bundle creation will be like src/UserBundle
. If you choose yes
, you need to add vendor name. After creation, the directory will be like src/XX/UserBundle
However, there may be no sharing plan during creation. If you plan to share in the future, you need to reorganize the file namespace
and the corresponding configuration file.
So should vendor name always be included when bundle is created?
For example src/XX/UserBundle
or src/XX/Bundle/UserBundle
The side effect of this is that when you are not going to share the current bundle, you have an extra namespace
in the application source code. Or there is an extra prefix when defining service
and route
, such as xx_user.user_manager
This eliminates the need to worry about changing the directory structure, namespace, route and service namespace issues when sharing the current bundle in the future.
What do you think?
Why vendorName?
VendorName is to avoid conflicts with the same bundleName of different Vendors. Simply put, it is to avoid naming conflicts. For example, if two Vendors, Foo and Bar, have to create a UserBundle, then a conflict will occur if vendorName is not added. This is not difficult. Do you understand?
Under what circumstances should vendorName be included?
If your bundle is only used in the current project, rather than as a shared third-party bundle (usually needs to be published as a composer package), then vendorName is not required, otherwise vendorName is required.

Symfony是一种基于PHP语言的高性能、可重复使用的web应用程序框架。它用于构建高质量的web应用程序和服务,并提供多种功能和工具来简化开发过程。Symfony的目标是使Web开发变得更加可用、可重复使用和高效,并且是一个开源框架,它遵循最佳的软件工程实践。对于PHP开发者来说,Symfony框架是一个非常好的选择,因为它提供了丰富而强大的灵活性,可以

随着信息技术的快速发展,企业管理系统越来越普及。其中,客户关系管理系统(CRM)是一种非常流行的企业管理系统。当今企业面临的最大挑战之一是如何有效地管理客户关系。开发一个高效的CRM系统就成了一个发展企业的核心任务。本文将介绍如何使用PHP框架Symfony,结合其丰富的功能和文档资料,来开发一款高效的CRM系统。一、了解Symfony框架Symfony是一

Symfony框架是一款流行的PHP框架,它的优势很多,本文将对于Symfony框架的优势进行探讨。高度的灵活性Symfony框架非常灵活,可以满足各种各样的需求。通过使用它的不同组件,你可以使用你自己的代码来构建自己的块,而无需使用强制性的体系结构。这使得Symfony框架成为开发出高度复杂的应用程序的理想选择。强大的安全性Symfony框架是一个非常安全

使用Symfony框架实现用户权限管理的步骤Symfony框架是一个功能强大的PHP开发框架,使用它可以快速开发出高质量的Web应用程序。在开发Web应用程序时,用户权限管理是一个不可忽视的重要部分。本文将介绍使用Symfony框架实现用户权限管理的步骤,并附带代码示例。第一步:安装Symfony框架首先,我们需要在本地环境中安装Symfony框架。可以通过

Symfony框架中间件:提供错误处理和异常管理功能当我们在开发应用程序时,经常会遇到错误和异常的情况。为了优化用户体验和提供更好的开发者工具,Symfony框架提供了强大的错误处理和异常管理功能。在本文中,我们将介绍Symfony框架中间件的使用和示例代码。Symfony框架中的错误处理和异常管理功能主要通过中间件来实现。中间件是一个特殊的功能组件,用于在

随着社交媒体应用的不断增长,越来越多的开发人员开始关注哪个框架最适合用来构建这样的应用。Symfony和Phalcon是两个非常受欢迎的PHP框架,它们都有着成熟的社区和强大的开发工具。但是如果你需要开发大规模的社交媒体应用程序,那么哪个框架更适合呢?Symfony是一个成熟的PHP框架,它提供了丰富的功能和工具,可以帮助你快速构建大型应用程序。Symfon

使用Symfony框架实现文件上传和下载的步骤在现代的Web应用程序中,文件上传和下载是一项常见的功能需求。Symfony框架为我们提供了一种简单而强大的方式来实现文件上传和下载功能。本文将介绍如何使用Symfony框架来实现文件上传和下载功能,并提供相应的代码示例。步骤一:安装Symfony框架首先,我们需要在本地环境中安装Symfony框架。可以通过Co

Symfony框架中的表单组件是一种非常有用的工具,可以帮助我们轻松地创建和验证表单,并与数据库进行交互。在本文中,我们将介绍如何在Symfony框架中使用表单组件。一、安装Symfony框架在开始之前,我们需要确保Symfony框架已经安装好并配置好依赖项。如果您尚未安装Symfony,可以通过以下命令在终端中安装:$curl-sShttps://g


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
