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.
$ cd /path-to/the-bundle-project
$ git clone https://github.com/pierrechls/sf-standalone-bundle.git Tests
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
- Adding autoload configuration
"autoload": {
"psr-4": {
"AppBundle\\AppBundle\\": ""
}
}
- Adding HttpKernel dependency in your
composer.json
"require": {
"symfony/http-kernel": "~2.3"
}
-
Open the file named
AppKernel.php
into theapp
folder -
Adding your bundle, for example :
public function registerBundles()
{
return array(
// list of some bundles
new AppBundle\AppBundle() // your bundle
);
}
Adding your bundle configuration using config.yml
, parameters.yml
and services.yml
files.
$ php Tests/app/console.php
- Ignore
Tests
folder by adding this line in your.gitignore
bundle project :
Tests/
- For more informations you can check this article
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.
Project developed by pierrechls.