10/10/2014 - SYMFONY
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.
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,
# football/app/AppKernel.php
in_array($this->getEnvironment(), array('test', 'dev', 'stag', 'prod'))
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);
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.
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
#doctrine:
# dbal:
# driver: pdo_sqlite
# path: %kernel.cache_dir%/default.db
# charset: UTF8
doctrine:
dbal:
connections:
default:
driver: pdo_sqlite
path: %kernel.cache_dir%/default.db
charset: UTF8
You can place a few dummy documents and images in dummy
folder since you will be using them in your behat tests.
build
dummy
document # Dummy docs used by behat to upload
.gitkeep
image # Dummy images used by behat to upload
.gitkeep
phing
behat
report # Line by line scenario report (failed and succeeded list)
.gitkeep
screenshot # Screenshots of failed scenarios
.gitkeep
phpcpd # Copy/Paste Detector
.gitkeep
phpcs # CodeSniffer (similar to PHP-CS-Fixer)
.gitkeep
phpdoc # phpDocumentor
.gitkeep
phploc # Project size analyser
.gitkeep
phpmd # Mess Detector
.gitkeep
###
# PROJECT
###
/web/bundles/
/app/bootstrap.php.cache
/app/cache/*
/app/config/parameters.yml
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep
/app/phpunit.xml
/app/upload/document/*
!/app/upload/document/.gitkeep
/web/upload/image/*
!/web/upload/image/.gitkeep
/vendor/
/bin/
/composer.phar
UPGRADE*.md
###
# BUILD
###
!/build/dummy/*
/build/phing/behat/report/*
!/build/phing/behat/report/.gitkeep
/build/phing/behat/screenshot/*
!/build/phing/behat/screenshot/.gitkeep
/build/phing/phpcpd/*
!/build/phing/phpcpd/.gitkeep
/build/phing/phpcs/*
!/build/phing/phpcs/.gitkeep
/build/phing/phpdoc/*
!/build/phing/phpdoc/.gitkeep
/build/phing/phploc/*
!/build/phing/phploc/.gitkeep
/build/phing/phpmd/*
!/build/phing/phpmd/.gitkeep
Dropping a .htaccess
in web/upload/image/
directory to prevent hot linking and listing images is suggested.
# football/app/config/parameters.yml.dist
parameters:
upload:
image_dir: ../web/upload/image/
document_dir: %kernel.root_dir%/upload/document/
valid_image_extensions:
- jpg
- jpeg
- gif
- png
thumbnail_settings:
height: 200
width: 200
red: 200
green: 0
blue: 0