symfony:symfony_tutorial_notes:the_bundle_system
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
symfony:symfony_tutorial_notes:the_bundle_system [2015/09/17 00:54] – created mithat | symfony:symfony_tutorial_notes:the_bundle_system [2015/09/18 04:04] (current) – [Bundle Directory Structure] mithat | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | The Bundle System | + | ====== |
- | + | ||
- | Everything | + | **Everything** is a bundle. |
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * [[http://symfony.com/doc/ | + | * [[http://knpbundles.com/|Third party bundles]] |
* In reality, a bundle can live anywhere as long as it can be autoloaded (via '' | * In reality, a bundle can live anywhere as long as it can be autoloaded (via '' | ||
- | ====== Enabling bundles | + | ===== Enabling bundles ===== |
Enabling bundles is done by hacking '' | Enabling bundles is done by hacking '' | ||
Line 36: | Line 36: | ||
</ | </ | ||
+ | ===== Creating a Bundle ===== | ||
+ | To create '' | ||
+ | - create a '' | ||
+ | namespace Acme\TestBundle; | ||
+ | |||
+ | use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
+ | |||
+ | class AcmeTestBundle extends Bundle | ||
+ | { | ||
+ | } | ||
+ | </ | ||
+ | - enable it via the AppKernel class:< | ||
+ | public function registerBundles() | ||
+ | { | ||
+ | $bundles = array( | ||
+ | // ... | ||
+ | // register your bundle | ||
+ | new Acme\TestBundle\AcmeTestBundle(), | ||
+ | ); | ||
+ | // ... | ||
+ | |||
+ | return $bundles; | ||
+ | } | ||
+ | </ | ||
+ | - Hack on controllers, | ||
+ | |||
+ | To create '' | ||
+ | * <code bash>$ php app/console generate: | ||
+ | |||
+ | The bundle skeleton generates a basic controller, template, and routing resource. | ||
+ | |||
+ | The '' | ||
+ | |||
+ | See [[http:// | ||
+ | |||
+ | ===== Bundle Directory Structure ===== | ||
+ | |||
+ | By default, the bundle system follows a set of conventions that help to keep code consistent: | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | | ||
+ | <WRAP center round tip 100%> | ||
+ | Note that the current [[http:// | ||
+ | * **config** goes in '' | ||
+ | * **controllers** go in '' | ||
+ | * **views** go in '' | ||
+ | * **assets** go in '' | ||
+ | * **tests** go in TBD | ||
+ | </ | ||
symfony/symfony_tutorial_notes/the_bundle_system.1442451291.txt.gz · Last modified: 2015/09/17 00:54 by mithat