Skip to content

pierrechls/sf-standalone-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

version php-v sf

sf-standalone-bundle

An empty application in your Symfony2 bundle

Create an empty application in your bundle to test it (manually or automatically) outside of an actual application.

🚀 How to use it

Go to your bundle project

$ cd /path-to/the-bundle-project

Clone the repo into a Tests folder

$ git clone https://github.com/pierrechls/sf-standalone-bundle.git Tests

Your bundle structure

Now your bundle structure should look something like this :

.
├── src/
│   └── AppBundle/
│
├── Tests/
│   ├── app/
│   │   ├── config/
│   │   │   ├─ config.yml
│   │   │   ├─ parameters.yml
│   │   │   └─ services.yml
│   │   ├── .htaccess
│   │   ├── AppCache.php
│   │   ├── AppKernel.php
│   │   ├── autoload.php
│   │   └── console.php
│
└── .gitignore

Update the composer.json file of your bundle

  • Adding autoload configuration
"autoload": {
    "psr-4": {
        "AppBundle\\AppBundle\\": ""
    }
}
  • Adding HttpKernel dependency in your composer.json
"require": {
    "symfony/http-kernel": "~2.3"
}

Adding your bundle into the Kernel

  • Open the file named AppKernel.php into the app folder

  • Adding your bundle, for example :

public function registerBundles()
{
    return array(
        // list of some bundles
        new AppBundle\AppBundle() // your bundle
    );
}

Configure

Adding your bundle configuration using config.yml, parameters.yml and services.yml files.

Run console

$ php Tests/app/console.php

Advice

  • Ignore Tests folder by adding this line in your .gitignore bundle project :
Tests/
  • For more informations you can check this article

🙌 Contribute

Contributing to sf-standalone-bundle it's a piece of 🍰. You have an idea about a new feature ? Fork the repo, do your stuff and open a pull request ! You can also report a problem or a suggestion by opening an issue.

🎉 Credits

Project developed by pierrechls.