Skip to content

Create Symfony2 Bundle

andyceo edited this page Oct 23, 2014 · 1 revision

Main instructions

  • The first assumption is that you already have a repository with bundle in it.

  • If so, install Symfony (or maybe you already have Symfony installed).

  • Update composer.json file. Create a section repositories, usually it placed between require and scripts sections and place the LanderBundle repository to the section repositories:

        "repositories": [
            {
                "type": "package",
                "package": {
                    "name": "vendor/your-bundle",
                    "version": "master",
                    "autoload": { "psr-0": { "Vendor\\YourBundle": "" } },
                    "target-dir": "Vendor/YourBundle",
                    "source": {
                        "url": "git@bitbucket.org:vendor/yourbundle.git",
                        "type": "git",
                        "reference": "master"
                    }
                }
            }
        ],
    
  • In the require section of composer.json, put the LanderBundle with version:

        "require": {
            "vendor/your-bundle": "dev-master"
        },
    
  • Run composer update in Symfony directory.

  • Enable the LanderBundle.

        // app/AppKernel.php
    
        // ...
        class AppKernel extends Kernel
        {
            // ...
    
            public function registerBundles()
            {
                $bundles = array(
                    // ...,
                    new Vendor\YourBundle\VendorYourBundle(),
                );
    
                // ...
            }
        }
    
  • Configure the YourBundle if needed (app/config/config.yml).

  • Include routing from YourBundle to the installed Symfony2 project. In file app/config/routing.yml, add following:

        vendor_your_bundle:
            resource: "@VendorYourBundle/Resources/config/routing.yml"
    
  • Install resources:

        app/console assets:install
    

Дополнительные инструкции

Sidebar is under construction

Clone this wiki locally