Creating the bundle
While developing our app initially, we didn't care about where our files were. Everything was under a giant monolithic bundle that included everything. We'll go through the following steps to change the situation and make a decoupled GithubAuthBundle
:
Set up the bundle.
Move or write the code.
Move or create the services configuration directly in the bundle.
Define the bundle configuration and merge the user-defined parameters.
First, we will use the following command line provided by Symfony to generate an empty bundle:
php app/console generate:bundle
To do this, you have to choose a namespace and a bundle name, which in the case of this book are Khepin
and GithubAuthBundle
. Now, let's move all the required files to this new bundle and update their namespaces accordingly. In the end, our bundle structure should be as follows:
GithubAuthBundle/ DependencyInjection/ Configuration.php KhepinGithubAuthExtension.php Resources/ config/ ...