phil / microsymfony
Start a Symfony app without a database, on FrankenPHP, with Castor tasks and every quality gate already passing.
Package info
github.com/parler-haut-interagir-librement/MicroSymfony
Type:project
pkg:composer/phil/microsymfony
Requires
- php: >=8.5
- ext-ctype: *
- ext-dom: *
- ext-iconv: *
- ext-libxml: *
- ext-mbstring: *
- ext-simplexml: *
- ext-xml: *
- league/commonmark: ^2.10
- sentry/sentry-symfony: ^5.17
- symfony/asset: ^8.2
- symfony/asset-mapper: ^8.2
- symfony/cache-contracts: ^3.8
- symfony/console: ^8.2
- symfony/dotenv: ^8.2
- symfony/filesystem: ^8.2
- symfony/flex: ^2.12
- symfony/form: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/http-foundation: ^8.2
- symfony/http-kernel: ^8.2
- symfony/intl: ^8.2
- symfony/monolog-bundle: ^4.1
- symfony/options-resolver: ^8.2
- symfony/routing: ^8.2
- symfony/runtime: ^8.2
- symfony/security-csrf: ^8.2
- symfony/stimulus-bundle: ^3.8
- symfony/string: ^8.2
- symfony/translation: ^8.2
- symfony/twig-bundle: ^8.2
- symfony/ux-turbo: ^3.8
- symfony/validator: ^8.2
- symfony/web-link: ^8.2
- symfony/yaml: ^8.2
- twig/extra-bundle: ^3.31
- twig/markdown-extra: ^3.31
- twig/twig: ^3.31
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.9
- brianium/paratest: ^7.30
- ergebnis/phpunit-slow-test-detector: ^2.29
- phil/dev-tools: ^0.2.1@alpha
- phpunit/phpunit: ^13.4
- shipmonk/composer-dependency-analyser: ^1.8
- symfony/browser-kit: ^8.2
- symfony/css-selector: ^8.2
- symfony/debug-bundle: ^8.2
- symfony/maker-bundle: ^1.68
- symfony/panther: ^2.4
- symfony/requirements-checker: ^2.0
- symfony/stopwatch: ^8.2
- symfony/web-profiler-bundle: ^8.2
Suggests
None
Provides
None
Conflicts
This package is auto-updated.
Last update: 2026-12-04 15:13:17 UTC
README
About ๐
MicroSymfony is a Symfony 8.2 application template on steroids, ready to use: a sandbox with sensible defaults, tests of every kind and strict quality gates, to start a proof of concept, try an idea or build a small application. It stays micro: no database, English and French pages, and nothing a small application does not need. Doctrine comes with WebSymfony, the next template up.
This template is the PHIL version of strangebuzz/MicroSymfony, created and maintained by COil of Strangebuzz. It keeps its name, its features and its spirit, and follows its releases. What differs, and why, is listed in Differences from strangebuzz/MicroSymfony. The philosophy behind the template is explained by its author:
Table of Contents ๐
- Demo
- Quick-start
- Requirements
- Stack
- Features
- Tasks
- Quality gates
- Differences from strangebuzz/MicroSymfony
- Notes
- Other good practices
- ADR
- What it doesn't ship?
- PHIL bundles
- References
- Others โProclaim Honestly, Interact Liberallyโ Skeletons
- Contributing
- Security
- Credits
- License
- Built with MicroSymfony
Demo ๐
A live demo is always better than an explanation:
- the live demo will be at https://ph-il.ca/demos/microsymfony;
- the one served by FrankenPHP in worker mode will be at https://ph-il.ca/demos/frankenphp/microsymfony.
Quick-start โก
Create a new project from the latest release:
composer create-project phil/microsymfony my-project && cd my-project
The repository is also a GitHub template repository: the "Use this template" button creates a new repository from the main branch, whose commits all pass the continuous integration.
With the Symfony binary ๐ถ
You need the Symfony binary and Castor:
castor start
Open https://127.0.0.1:8000 (if port 8000 is free). castor stop stops the server.
With FrankenPHP ๐ง
You need Docker. compose.yaml serves the application with
FrankenPHP in worker mode, which boots the kernel once and serves request after request,
and restarts its workers when a file changes:
castor up
Open https://localhost. castor down stops the service. The image of docker/Dockerfile is
for development: an application deployed from this template brings its own deployment.
Requirements โ
- PHP 8.5 or later, with the extensions of
composer.json, and Castor - The Symfony binary, or Docker
- The Xdebug or PCOV extension for the code coverage report
Stack ๐
- PHP 8.5
- Symfony 8.2
- Twig 3, with the pages in English and in French
- Sentry for the errors of the production environment
- AssetMapper, Stimulus 3.2 and Turbo 8, without Node.js
- PHPUnit 13
- Pico CSS 2.1
- FrankenPHP in worker mode, through Docker Compose
Features ๐
- Tasks run by Castor (source, output): the
common tasks of
phil/dev-tools, imported fromvendor/, and the template's own servers and environments - Static analysis with PHPStan 2 at the maximum level, with the strict, deprecation, Symfony and PHPUnit rules (configuration)
- Coding standards with PHP-CS-Fixer, Twig-CS-Fixer and Biome for the Stimulus controllers
- Tests of every kind, with one example each:
- unit: StringHelperTest
- integration: RoutingExtensionTest, and
ContainerTest, which builds every service of
src/ - functional: ComposerActionTest, and RouteSmokeTest, which requests every GET route
- API: SlugifyActionTest
- end-to-end: StimulusPageTest, in Chrome driven by Panther
- Code coverage at 100 % (the threshold is the
coverage_thresholdsetting ofPHIL_CASTORincastor.php) - A GitHub Actions workflow: security, tests on PHP 8.5 and 8.6, lints
- Pages in English and in French: the layout, the menu and the footer read their texts from translations/, and the home page shows the README of the language the browser prefers
- AssetMapper and Stimulus: a vanilla controller (source) and one that fetches JSON from an endpoint of the application (source)
- A custom error template (source)
Tasks ๐งฐ
castor lists every task. The main ones:
| Task | What it does |
|---|---|
castor start, castor stop |
The Symfony binary's web server. |
castor up, castor down |
FrankenPHP in worker mode, with Docker Compose. |
castor test |
Every PHPUnit suite but E2E; --filter and --options pass on to PHPUnit. |
castor test:unit, test:integration, test:api, test:functional |
One suite. |
castor test:e2e |
The E2E suite in a real browser, Chrome driven by Panther: it types a title on the Stimulus page and waits for the slug the api controller fetches. Chrome and chromedriver must be on the PATH, or let vendor/bin/bdi detect drivers download the driver into drivers/ after composer require --dev dbrekelmans/bdi. Neither castor test, castor coverage, castor ci nor the continuous integration runs it. |
castor test:suite <name> |
One suite of phpunit.dist.xml, by its name. |
castor test:next |
The tests on the next PHP version, in its Docker image. |
castor coverage |
The HTML coverage report in var/coverage/, and its threshold. |
castor infection |
Mutation testing. |
castor taint |
The taint analysis of Psalm. |
castor lint |
Every lint and the static analysis. |
castor fix |
Rector, PHP-CS-Fixer, Twig-CS-Fixer, Biome and composer-normalize. |
castor ci |
The continuous integration, locally: coverage, then every lint. |
castor hooks |
The git hooks: the fast checks on the staged files before each commit. |
Every task but the servers, go-prod, go-dev, purge and check-requirements comes from phil/dev-tools:
castor.php imports vendor/phil/dev-tools/resources/castor/tasks.php and sets the suites and the coverage threshold
in its PHIL_CASTOR constant; E2E is left out of its suites. A task of the application's own is added to castor.php
under a name of its own, and named in the test_also, lint_also, fix_also or ci_also setting to run with the
aggregate tasks; the tasks and settings are described in vendor/phil/dev-tools/doc/castor.md.
Quality gates ๐ฆ
The checks come from phil/dev-tools, the shared tooling of PHIL,
adapted to an application. Each tool is installed in its own vendor-bin/<tool>/ directory by the
Composer bin plugin, so that its dependencies never meet the
application's. The thin configuration files at the root (phpstan.neon, rector.php, .php-cs-fixer.dist.php,
arkitect.php) call the shared ones; phil-dev.php holds what is particular to the application, each exception with
its reason.
| Task | Checks |
|---|---|
castor lint:composer |
The dependency analysis (a class used without its package required), composer audit, composer-unused and composer-normalize. |
castor lint:php |
PHP-CS-Fixer: @Symfony, @Symfony:risky, strict types and strict comparisons. |
castor lint:twig |
lint:twig, then the code style of the templates. |
castor lint:js |
Biome on the Stimulus controllers. |
castor lint:yaml, lint:container |
The YAML files, the messages included, and the container. |
castor stan |
PHPStan at the maximum level, with type coverage at 100 %, a cognitive complexity limit and forbidden calls. |
castor lint:rector |
Rector has nothing left to change. |
castor lint:architecture |
Arkitect on the shape of the classes; Deptrac on the libraries src/ may use, listed in phil-dev.php. |
The taint analysis of Psalm, castor taint, runs on its own, before a release and once a week: it follows what comes
from a request, a file or the environment to an HTML page, a shell, a file path or unserialize(). The .github/
directory also holds the security files of phil/dev-tools: Dependabot, with a cooldown of seven days, the OpenSSF
Scorecard and zizmor, which audits the workflows.
Differences from strangebuzz/MicroSymfony ๐
This template follows the releases of strangebuzz/MicroSymfony. It differs where the principles of PHIL ask for it:
| strangebuzz/MicroSymfony | This template | Why |
|---|---|---|
| The latest stable Symfony | Symfony 8.2, and the next minor version from its first release candidate, minimum-stability at beta |
PHIL tests on the next Symfony as soon as its release candidate is out. Symfony tags only the components that changed since the last beta, so beta is the lowest stability that installs a release candidate; prefer-stable takes the stable releases first. |
| PHP 8.4 or later | PHP 8.5 or later | The floor of every PHIL package and template; the continuous integration also runs the next PHP. |
Configuration in PHP, with the array shapes of App::config() |
Configuration in YAML: config/packages, routes and services |
The format of the Symfony documentation and of the Flex recipes, with when@env blocks; config/bundles.php and config/preload.php stay PHP. |
| Make and Castor | Castor only, no task script in composer.json |
One task runner, written in PHP; Composer stays a dependency manager. |
| PHPStan and PHP-CS-Fixer, Biome through a bundle | The gates of phil/dev-tools: PHPStan with its extensions, Rector, Arkitect, Deptrac, Twig-CS-Fixer, Biome, the dependency analysis, composer-unused, composer-normalize, CaptainHook, Infection |
The checks every PHIL repository passes, so that an application starts at the same bar. |
| PHPUnit tests, coverage metadata optional | #[CoversClass] or #[CoversNothing] required, deprecations, notices and warnings fail |
Coverage counts only what a test sets out to test, and a deprecation is fixed before the next version removes it. |
Doctrine ORM on SQLite, a User entity and Foundry |
No database | A micro application needs none; WebSymfony brings Doctrine. |
| Pages in English | Pages in English and in French, chosen from the browser's languages | PHIL publishes in both languages. |
| No error tracking | Sentry in the production environment, off while SENTRY_DSN is empty |
An application in production reports its errors from its first deployment. |
A FrankenPHP demo with docker run |
compose.yaml with FrankenPHP in worker mode |
One command for the production-like setup; the Symfony binary stays the light choice. |
| Deployment tasks, Apache configuration, Scrutinizer | None | A template holds no deployment: each application brings its own. |
| A procedure to downgrade to Symfony 7.4 LTS | None | PHIL supports the latest Symfony only. |
| Exit codes of the aggregate tasks summed | Exit codes reduced to 0 or 1 | A shell keeps exit codes modulo 256: a sum of 256 reads as a success. |
Besides those, the template keeps the PHIL identity: its name, its logo as the favicon and its copyright. The template
requires no PHIL package at run time: phil/dev-tools is a development dependency only, and the
application stays micro.
Notes ๐
Symfony UX
Turbo forms are disabled in assets/app.js. To enable them for a form, add the data-turbo="true"
attribute to it, or set Turbo.setFormMode to on to enable them everywhere. In both cases, the controller has to be
adapted.
YAML configuration files
The configuration of Symfony and of the bundles is in YAML, under config/: config/packages/*.yaml, with
when@dev, when@test and when@prod blocks for what changes by environment, config/routes.yaml,
config/routes/*.yaml and config/services.yaml. A Flex recipe adds its files in the same format. Only
config/bundles.php and config/preload.php stay PHP. castor lint:yaml checks every file of config/, and
castor lint:container checks the container they build.
# config/packages/framework.yaml framework: default_locale: en enabled_locales: [en, fr] set_locale_from_accept_language: true
Languages
The pages are in English, the default locale, and in French: config/packages/framework.yaml enables both, and a
browser whose Accept-Language header prefers French gets the French pages, on the same addresses. The messages are
in translations/; a new visible text gets its key in both files.
Sentry
In the production environment, the errors go to Sentry once SENTRY_DSN holds the DSN of your
project, set as a real environment variable or a secret, never in a committed file. While it is empty, as in .env,
nothing is sent. The configuration is in config/packages/sentry.yaml.
A database
MicroSymfony has none. For Doctrine, start from WebSymfony,
or add it with composer require symfony/orm-pack.
Other good practices ๐
- Strict types in every PHP file (source)
- The ADR pattern: one invokable action controller per route (source, documentation)
- The configuration in YAML, under
config/(source) - A composer.json normalized with ergebnis/composer-normalize
- Each quality tool in its own
vendor-bin/<tool>/directory, installed by the composer bin plugin - Tests that name what they cover, with
#[CoversClass]or#[CoversNothing]
ADR ๐
Architecture Decision Records of strangebuzz/MicroSymfony; this template keeps every one but the one on Doctrine and the two on PHP configuration:
- [2026-01-17] Use Doctrine ORM as the default database layer (PR)
- [2025-12-29] Use the new PHP configuration (PR)
- [2025-01-25] Include the FrankenPHP runtime by default (PR)
- [2025-01-21] Add PHPUnit test suites (PR)
- [2024-12-18] Use PicoCSS instead of BareCSS as the CSS framework (PR)
- [2024-12-05] Convert all configuration files to PHP (fluent interface) (PR)
- [2024-09-22] Use the ADR pattern for all controllers (PR)
Those of this template:
- [2026-11-25] Symfony 8.2 from its release candidate, PHP 8.5, the gates of
phil/dev-tools, Castor only, FrankenPHP in worker mode incompose.yaml - [2026-11-25] No database: Doctrine moves to WebSymfony; pages in English and in French; Sentry in production
- [2026-11-26] The configuration in YAML:
config/packages, routes and services - [2026-11-26] The common Castor tasks of
phil/dev-toolsimported bycastor.php; the route smoke test ofphil/dev-tools; every requirement at its latest minor release
What it doesn't ship? โ
- Doctrine and a database: start from WebSymfony
(
phil/websymfony), MicroSymfony with Doctrine
PHIL bundles ๐งฉ
The bundles of PHIL add what an application needs, one at a time, with composer require. A few
that suit a small application:
phil/ux-kitandphil/ux-css: phil-ux, the components of the Symfony UX Toolkit and their stylesphil/structured-data-bundleandphil/sitemap-bundle: the JSON-LD and the sitemap of the pagesphil/browser-security-bundle: the security headers of the responsesphil/privacy-bundleandphil/legal-notices-bundle: the consent and the legal pagesphil/well-known-bundle:security.txtand the other files of/.well-known/phil/typography-bundle: the typography of French and English texts
The PHIL organization on GitHub lists every package.
References ๐
- Introducing the MicroSymfony application template (strangebuzz.com)
- MicroSymfony 8: ready for the LTS promise (strangebuzz.com)
- Initializing your Symfony project with solid foundations (strangebuzz.com)
- Organizing your Symfony project tests (strangebuzz.com)
- A better ADR pattern for your Symfony controllers (strangebuzz.com)
- Castor, a journey across the sea of task runners (jolicode.com)
- PHPStan 2.0 Released With Level 10 and Elephpants! (phpstan.org)
- You should be using PHPStan's bleeding edge (backendtea.com)
- A Good Naming Convention for Routes, Controllers and Templates? (jolicode.com)
- Front-end application development, Symfony-style(s) (dunglas.dev)
- The Symfony Framework Best Practices (symfony.com)
Others โProclaim Honestly, Interact Liberallyโ Skeletons ๐ฉป
-
WebSymfony (
phil/websymfony)- MicroSymfony +
- A database
- Doctrine ORM and its migrations
- StofDoctrineExtensionsBundle
- Still Pico CSS, with Stimulus and Turbo
- EasyAdmin
- KnpMenuBundle
- Security layers
- Symfony Security
- NelmioSecurityBundle
- NelmioCorsBundle
- Sentry
- and more.
-
WebSkeleton (
phil/webskeleton)- WebSymfony +
- The PHIL tools
- The PHIL UX kit (
phil/ux-kit) and its styles (phil/ux-css) - PHIL bundles, such as
phil/doctrine-behaviours-bundle, the behaviours of the Doctrine entities, andphil/publishing, the publication of contents
- The PHIL UX kit (
- Organised in DDD
- In French and in English (
/fr,/en) - and more.
-
ApiSymfony (
phil/apisymfony)- API Platform
- The same tasks, run by Castor
- Static analysis with PHPStan
- Coding standards with PHP-CS-Fixer
- Refactoring with Rector
- Tests: unit, API and end-to-end
- GitHub CI
- Symfony Maker
Contributing ๐ค
See CONTRIBUTING and the Code of Conduct.
Security ๐งฏ
See SECURITY.
Credits ๐
- COil, author of strangebuzz/MicroSymfony, and its contributors
- Philippe Gamache, maintainer of this template, for Parler Haut, Interagir Librement
License โ๏ธ
The MIT License, with the attribution to the original repository it asks for. See the license file.
Built with MicroSymfony ๐ ๏ธ
- WebSymfony, which lists what is built with it, starting with WebSkeleton.