Hello everyone!

We have been investing plenty of personal time and energy for many years to share our knowledge with you all. However, we now need your help to keep this blog running. All you have to do is just click one of the adverts on the site, otherwise it will sadly be taken down due to hosting etc. costs. Thank you.

In this example, we're going to isolate prod, dev, stag and test environment from each other.


In general, file upload folders should have 755 permission and you might need to set Ubuntu or Mac specific permissions to the folders as defined here.

Composer config

You need to run composer update after adding lines below. Always use specific version numbers for packages.

# football/composer.json
"minimum-stability": "stable",
"prefer-stable": true,

AppKernel config

# football/app/AppKernel.php
in_array($this->getEnvironment(), array('test', 'dev', 'stag', 'prod'))

New front controllers for environments

Copy the content of football/web/app_dev.php and create app_prod.php, app_dev.php, app_stag.php and app_test.php versions by changing lines below.

$kernel = new AppKernel('prod', true);
$kernel = new AppKernel('stag', true);
$kernel = new AppKernel('dev', true);
$kernel = new AppKernel('test', true);

Config files

You will probably won't have football/app/config/config_stag.yml so copy the content from football/app/config/config_test.yml to create one. As a result, you'll have 4 config files for each environments.

Update config_test.yml

Sometimes Ubuntu and Mac specific permissions, as link provided above, might cause "writing" permissions so you just need to assign 755 to "test" folder.

# football/app/config/config_test.yml
# dbal:
# driver: pdo_sqlite
# path: %kernel.cache_dir%/default.db
# charset: UTF8

driver: pdo_sqlite
path: %kernel.cache_dir%/default.db
charset: UTF8

Build folder structure

You can place a few dummy documents and images in dummy folder since you will be using them in your behat tests.

document # Dummy docs used by behat to upload
image # Dummy images used by behat to upload
report # Line by line scenario report (failed and succeeded list)
screenshot # Screenshots of failed scenarios
phpcpd # Copy/Paste Detector
phpcs # CodeSniffer (similar to PHP-CS-Fixer)
phpdoc # phpDocumentor
phploc # Project size analyser
phpmd # Mess Detector

.gitignore config



Custom project specific parameters

Dropping a .htaccess in web/upload/image/ directory to prevent hot linking and listing images is suggested.

# football/app/config/parameters.yml.dist
image_dir: ../web/upload/image/
document_dir: %kernel.root_dir%/upload/document/
- jpg
- jpeg
- gif
- png
height: 200
width: 200
red: 200
green: 0
blue: 0