Symfony 4: Automate your Workflow

Symfony Flex

{
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
},
"composer-scripts": {
"vendor/bin/security-checker security:check": "php-script"
}
}

Bundles

{
"bundles": {
"Symfony\\Bundle\\DebugBundle\\DebugBundle": ["dev", "test"],
"Symfony\\Bundle\\MonologBundle\\MonologBundle": ["all"]
}
}

Configuration

{
"copy-from-package": {
"bin/check.php": "%BIN_DIR%/check.php"
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"src/": "%SRC_DIR%/"
}
}

Environment Variables

{
"env": {
"APP_ENV": "dev",
"APP_DEBUG": "1"
}
}

Makefile Tasks

cache-clear:
@test -f bin/console && bin/console cache:clear --no-warmup || rm -rf var/cache/*
.PHONY: cache-clear
cache-warmup: cache-clear
@test -f bin/console && bin/console cache:warmup || echo "cannot warmup the cache (needs symfony/console)"
.PHONY: cache-warmup

Composer Scripts

{
"scripts": {
"auto-scripts": [ ],
"post-install-cmd": [ "@auto-scripts" ],
"post-update-cmd": [ "@auto-scripts" ]
}
}
{
"composer-scripts": {
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
}
}

.gitignore

{
"gitignore": [
"/phpunit.xml"
]
}

post-install-output

Execute <fg=blue>make serve</> to run your application.

Full Example

{
"bundles": {
"Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"public/": "%PUBLIC_DIR%/",
"src/": "%SRC_DIR%/"
},
"composer-scripts": {
"make cache-warmup": "script",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
},
"env": {
"APP_ENV": "dev",
"APP_DEBUG": "1",
"APP_SECRET": "%generate(secret)%"
},
"gitignore": [
".env",
"/public/bundles/",
"/var/",
"/vendor/"
]
}

An Opinionated Repository

The Symfony Flex Server

--

--

--

founder and CEO @SensioLabs and @blackfireio, founder and project lead @Symfony

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Squash, the definitive cloud-native debugging tool

Personal List: 2017 Year-in-Review

This Fibonacci Memoization In C Program Has Plagued Me For Ages

Quick Guide to responsively style with Bootstrap

ROCKtropia Virtual World — Blockchain Election Results.

Decorators in python — Part-3

Kubernetes Fundamentals: Common Terms

Day #12 of Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fabien Potencier

Fabien Potencier

founder and CEO @SensioLabs and @blackfireio, founder and project lead @Symfony

More from Medium

Your Road To Symfony 6 Certification

Testingmania #4: Testing Form Requests with PHPUnit

Symfony Station Communiqué — 18 March 2022. A look at Symfony and PHP news!

Code logo

PHP — CodeSniffer standard