phil / webskeleton
The base of a Symfony site: French and English, DDD layers, the PHIL UX kit, security headers, legal pages, contact form, sitemap, tests and quality gates.
Package info
github.com/parler-haut-interagir-librement/WebSkeleton
Type:project
pkg:composer/phil/webskeleton
Requires
- php: >=8.5
- ext-ctype: *
- ext-iconv: *
- ext-simplexml: *
- ext-xml: *
- doctrine/dbal: ^4.6
- doctrine/doctrine-bundle: ^3.4
- doctrine/doctrine-migrations-bundle: ^4.0
- doctrine/migrations: ^3.10
- doctrine/orm: ^3.8
- doctrine/persistence: ^4.2
- easycorp/easyadmin-bundle: ^5.10
- phil/accessibility-statement-bundle: ^0.1.1@alpha
- phil/browser-security-bundle: ^0.2.1@alpha
- phil/circuit-breaker-bundle: ^0.2@alpha
- phil/contact-form-bundle: ^0.1.3@alpha
- phil/cors-bundle: ^0.1.0@alpha
- phil/ddd-bundle: ^0.2.0@alpha
- phil/doctrine-behaviours: ^0.3.1@alpha
- phil/doctrine-behaviours-bundle: ^0.3@alpha
- phil/error-tracking-bundle: ^0.1.1@alpha
- phil/feature-flags-bundle: ^0.1.3@alpha
- phil/legal-notices-bundle: ^0.1.1@alpha
- phil/menu-bundle: ^0.1.1@alpha
- phil/monitoring-bundle: ^0.1.1@alpha
- phil/privacy-bundle: ^0.4@alpha
- phil/sitemap: ^0.1.1@alpha
- phil/sitemap-bundle: ^0.1.1@alpha
- phil/spam-protection-bundle: ^0.3.1@alpha
- phil/structured-data-bundle: ^0.1@alpha
- phil/ux-bundle: ^0.1.2@alpha
- phil/ux-css: ^0.6@alpha
- phil/ux-easyadmin-bundle: ^0.1.1@alpha
- phil/ux-kit: ^0.7@alpha
- phil/well-known-bundle: ^0.1.1@alpha
- psr/log: ^3.0
- symfony/asset: ~8.2.0
- symfony/asset-mapper: ~8.2.0
- symfony/clock: ~8.2.0
- symfony/console: ~8.2.0
- symfony/dependency-injection: ~8.2.0
- symfony/doctrine-bridge: ~8.2.0
- symfony/dotenv: ~8.2.0
- symfony/flex: ^2.12
- symfony/form: ~8.2.0
- symfony/framework-bundle: ~8.2.0
- symfony/http-client: ~8.2.0
- symfony/http-foundation: ~8.2.0
- symfony/http-kernel: ~8.2.0
- symfony/intl: ~8.2.0
- symfony/lock: ~8.2.0
- symfony/mailer: ~8.2.0
- symfony/messenger: ~8.2.0
- symfony/monolog-bundle: ^4.1
- symfony/options-resolver: ~8.2.0
- symfony/password-hasher: ~8.2.0
- symfony/rate-limiter: ~8.2.0
- symfony/routing: ~8.2.0
- symfony/runtime: ~8.2.0
- symfony/security-bundle: ~8.2.0
- symfony/security-core: ~8.2.0
- symfony/security-csrf: ~8.2.0
- symfony/security-http: ~8.2.0
- symfony/serializer: ~8.2.0
- symfony/stimulus-bundle: ^3.8
- symfony/string: ~8.2.0
- symfony/translation: ~8.2.0
- symfony/twig-bundle: ~8.2.0
- symfony/ux-turbo: ^3.8
- symfony/ux-twig-component: ^3.8
- symfony/validator: ~8.2.0
- symfony/web-link: ~8.2.0
- symfony/yaml: ~8.2.0
- twig/extra-bundle: ^3.31
- twig/intl-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/accessibility-check: ^0.1.2@alpha
- phil/dev-tools: ^0.2.1@alpha
- phpunit/phpunit: ^13.4
- shipmonk/composer-dependency-analyser: ^1.8
- symfony/browser-kit: ~8.2.0
- symfony/css-selector: ~8.2.0
- symfony/debug-bundle: ~8.2.0
- symfony/http-client-contracts: ^3.6
- symfony/maker-bundle: ^1.68
- symfony/panther: ^2.4
- symfony/requirements-checker: ^2.0
- symfony/stopwatch: ~8.2.0
- symfony/web-profiler-bundle: ~8.2.0
- zenstruck/foundry: ^2.17
Suggests
None
Provides
None
Conflicts
README
About π
βProclaim Honestly, Interact Liberallyβ WebSkeleton is the base of a Symfony 8.2
site: French and English, organised in domain-driven design (Domain, Application, Infrastructure), dressed by the PHIL
UX kit, with member accounts, an EasyAdmin administration and the PHIL bundles a public site needs from its first day β
security headers, legal notice, privacy policy, privacy choices of the members, accessibility statement, contact form,
error tracking, sitemap, security.txt and structured data β, and the same tests and quality gates as the other
templates of PHIL.
WebSkeleton is built on WebSymfony, itself built on MicroSymfony, the PHIL version of strangebuzz/MicroSymfony, created and maintained by COil of Strangebuzz. It is the first of these templates with the PHIL tools: phil-ux in place of Pico CSS, the PHIL UX kit, and the PHIL bundles.
Table of Contents π
- Demo
- Quick-start
- Requirements
- Stack
- What it adds to WebSymfony
- Configuration
- Languages
- Domain-driven design
- Accounts and administration
- Feature flags and circuit breakers
- Accessibility
- Before going live
- Optional steps
- Tasks
- Quality gates
- What it doesn't ship
- References
- Others βProclaim Honestly, Interact Liberallyβ Skeletons
- Contributing
- Security
- Credits
- License
- Built with WebSkeleton
Demo π
A demo of WebSkeleton will run in the browser on ph-il.ca, with the other templates of PHIL.
Quick-start β‘
Create a new project from the latest release:
composer create-project phil/webskeleton my-site && cd my-site
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. The database is a SQLite file in var/:
castor start
The task writes a random APP_SECRET to .env.local when it holds none, prepares the database and starts the server.
Open https://127.0.0.1:8000 (if port 8000 is free): / sends you to /fr or /en, after
the language of your browser. castor stop stops the server and deletes the database.
With FrankenPHP and PostgreSQL π§
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; the database is PostgreSQL 17, and
Mailpit catches the messages of the contact form:
castor secret && castor up
Open https://localhost. castor down stops the services. The image of docker/Dockerfile is
for development: a site built from this template brings its own deployment.
With MySQL π¬
MySQL is the other database the template supports. In compose.yaml, replace the database service with a
mysql:8.4 image and set DATABASE_URL to:
mysql://app:app@database:3306/app?serverVersion=8.4&charset=utf8mb4
With the Symfony binary, set the same variable in .env.local, with the host of your server.
Requirements β
- PHP 8.5 or later, with the extensions of
composer.json,intlandsodium, and Castor - The Symfony binary, or Docker
- The Xdebug or PCOV extension for the code coverage report
Stack π
- PHP 8.5
- Symfony 8.2, from its release candidate, with Messenger carrying the commands and queries
- Doctrine ORM 3 (DBAL 4), on SQLite, PostgreSQL or MySQL
- Symfony Security for the member accounts, and EasyAdmin 5 for the administration
- Twig 3 and Twig components
- AssetMapper, Stimulus 3.2 and Turbo 8, without Node.js
- phil-ux, the stylesheet of PHIL, light and dark, and the recipes of the PHIL UX kit
- PHPUnit 13
- FrankenPHP in worker mode, through Docker Compose
What it adds to WebSymfony π
| Feature | Where |
|---|---|
French and English, every page under /fr or /en, French by default |
routes.yaml, services.yaml, translations |
Domain, Application and Infrastructure layers in each bounded context, with the buses of phil/ddd-bundle |
src, messenger.yaml |
Typed identifiers of phil/ddd-bundle β a Doctrine type each, controller arguments, the Serializer β and its make:ddd:* commands in development |
AccountId, doc |
Member accounts: sign-up, sign-in, the account page and the sign-out, under /fr and /en, in the context Account |
src/Account, security.yaml |
The administration, EasyAdmin in the theme of PHIL UX by phil/ux-easyadmin-bundle, for ROLE_ADMIN |
DashboardController, phil_ux_easy_admin.yaml |
The privacy choices of each member β the export of their data, the deletion of their account, the consent β and the redaction of the logs, by phil/privacy-bundle |
phil_privacy.yaml, AccountPersonalData |
The errors of the site kept in its own database and shown in the administration, by phil/error-tracking-bundle |
phil_error_tracking.yaml |
Feature flags, off until an administrator turns them on under /admin/flags, by phil/feature-flags-bundle |
phil_feature_flags.yaml, doc |
A circuit breaker around each third party the site calls, by phil/circuit-breaker-bundle |
phil_circuit_breaker.yaml, doc |
The main menu, by phil/menu-bundle |
MainMenuBuilder |
The creation and update dates of the accounts, by phil/doctrine-behaviours-bundle |
User, phil_doctrine_behaviours.yaml |
phil-ux and the recipes of the PHIL UX kit in templates/components/ |
base.html.twig, components |
A Content Security Policy with nonces and the security headers, by phil/browser-security-bundle |
phil_browser_security.yaml |
The legal notice and the privacy policy, in both languages, by phil/legal-notices-bundle |
phil_legal_notices.yaml, legal |
The accessibility statement, by phil/accessibility-statement-bundle |
phil_accessibility_statement.yaml |
A contact form protected against spam, by phil/contact-form-bundle and phil/spam-protection-bundle |
phil_contact_form.yaml |
/sitemap.xml, every page in every language with its alternates, by phil/sitemap-bundle |
LocalizedPagesUrlProvider |
The cross-origin rules of the JSON endpoints under /api/, for the origins that CORS_ALLOW_ORIGIN matches, by phil/cors-bundle |
phil_cors.yaml, CorsTest |
/.well-known/security.txt, by phil/well-known-bundle |
phil_well_known.yaml |
The JSON-LD graph of each page, by phil/structured-data-bundle |
phil_structured_data.yaml |
Every page checked for accessibility, in both languages, by phil/accessibility-check, and every route by the smoke test of phil/dev-tools |
AccessibilityTest, RouteSmokeTest |
From WebSymfony stay the PHIL identity (logo, copyright of Parler Haut, Interagir Librement, light and dark themes),
the member accounts and their administration, the cross-origin rules on /api/, the five test suites, Castor, the
quality gates and Docker Compose. The PHIL bundles take the place of KnpMenu, of Sentry, of NelmioCorsBundle and of the
Doctrine extensions of Gedmo.
Every PHIL package comes from Packagist.
phil/monitoring-bundle is required without being registered: the configuration of phil/error-tracking-bundle
0.1.0-alpha reads a class that implements one of its interfaces.
Configuration ποΈ
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. The PHIL bundles are configured in the same format, as their Flex
recipes write it, and a recipe adds its own files next to them. 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/phil_sitemap.yaml phil_sitemap: default_section: main when@dev: &dev phil_sitemap: allow_localhost: true when@test: *dev
Languages π
Every page lives under the prefix of its language: /fr, /en. French is the default: / sends a visitor to the
language their browser prefers among those of the site, French when it prefers none of them. The layout links each
page to its other languages, and the sitemap lists them as alternates.
The languages are the list app.locales in config/services.yaml, the default one first,
and app.locale_requirement next to it, the same codes joined by | for the route prefix. To add Spanish:
- add
estoapp.localesand toapp.locale_requirement,fr|en|es; - copy
translations/messages.en.yamltotranslations/messages.es.yamland translate it; - give the legal documents their
esbody inlegal/and in phil_legal_notices.yaml.
The pages of /es then exist, with the routes of the PHIL bundles under the same prefix.
Domain-driven design π§
src/ is organised by bounded context: each context has its own three layers, src/<Context>/Domain,
src/<Context>/Application and src/<Context>/Infrastructure, and src/Shared holds what every context uses.
Deptrac checks both kinds of rules (castor lint:architecture, rules in phil-dev.php).
Inside a context, the layers:
| Layer | Holds | May use |
|---|---|---|
Domain |
Value objects, entities of the model, ports (interfaces): plain PHP, never services | PHP, the Symfony components, the domain of phil/ddd-bundle |
Application |
Commands, queries and their handlers | The domain, the buses of phil/ddd-bundle |
Infrastructure |
Controllers, adapters of the ports, Doctrine entities | Everything it integrates |
Between contexts, the isolation: a context may use the same layer of src/Shared and the layers below it, never
another context; src/Shared uses no context, and names the pages of the others by their routes. Here,
src/Shared/Infrastructure holds the controllers of the site pages, the dashboard of the administration, the menu,
the sitemap provider, Twig and the Doctrine entities every context shares.
src/
βββ Kernel.php
βββ Account/
β βββ Domain/ # AccountId, Role, Accounts (the port)
β βββ Application/ # SignUpCommand, ShowAccountQuery, their handlers, AccountView, AccountViews (a port)
β βββ Infrastructure/
β βββ Form/ # the sign-up form
β βββ Http/Admin/ # UserCrudController
β βββ Http/Api/ # /api/accounts/{account}
β βββ Http/Controller/ # login, signup, account, logout
β βββ Persistence/Doctrine/ # DoctrineAccounts, DoctrineAccountViews, UserRepository, Entity/User,
β β # Type/AccountIdType
β βββ Privacy/ # AccountPersonalData, for phil/privacy-bundle
βββ Shared/
β βββ Domain/
β βββ Application/
β βββ Infrastructure/
β βββ Http/Admin/ # DashboardController, /admin
β βββ Http/Controller/ # pages, under /fr and /en
β βββ Http/Root/ # "/", which sends to the visitor's language
β βββ Menu/
β βββ Persistence/Doctrine/Entity/
β βββ Sitemap/
β βββ Twig/
βββ Text/
βββ Domain/ # Slug, TitleSlugger
βββ Application/ # SlugifyTitleQuery, SlugifyTitleHandler
βββ Infrastructure/
βββ AsciiTitleSlugger.php
βββ Http/Api/ # /api/slugify
βββ Persistence/Doctrine/Entity/
The example context, Text, runs through the three layers: Slug is a value object that
validates itself and throws the InvalidValue of phil/ddd-bundle; TitleSlugger
is its port; SlugifyTitleQuery and its handler answer on the query bus;
AsciiTitleSlugger is the adapter on Symfony's slugger, bound to the
port in services.yaml; SlugifyAction asks
the bus and answers JSON, which the home page calls through a Stimulus controller.
The command bus runs in a Doctrine transaction, the query bus does not; both are synchronous until a message is routed to a transport in messenger.yaml. Messages carry identifiers, never whole objects.
The context Account shows the identifiers of phil/ddd-bundle: AccountId is a
UUIDv7 of its own class, stored by its DBAL type AccountIdType
registered in doctrine.yaml; ShowAccountAction,
for the administrators, receives the placeholder of /api/accounts/{account} as an AccountId β anything else is a
404 β and the Serializer writes the identifier of the answer as its string. The make:ddd:* commands of the bundle, in
the development environment, write a context and its classes in this layout. Both are in doc/ddd.md.
Adding a context
For a context named Catalog, bin/console make:ddd:context Catalog writes the folders and a README, and the other
make:ddd:* commands write its identifiers, commands, queries and events (doc/ddd.md); then:
- The folders:
src/Catalog/Domain,src/Catalog/Applicationandsrc/Catalog/Infrastructure, with the namespacesApp\Catalog\Domain,App\Catalog\ApplicationandApp\Catalog\Infrastructure; its tests mirror them undertests/Unit/Catalog/andtests/Integration/Catalog/. - The services: nothing to add for the folders, since services.yaml loads
src/and leaves out everysrc/*/Domain/and the commands and queries of everysrc/*/Application/. Each port of the domain gets its alias to its adapter there, next toTitleSlugger. - The routes: nothing to add either: routes.yaml finds the controllers of every context in
Infrastructure/Http/Controller(under the language prefix),Infrastructure/Http/Api(under/api) andInfrastructure/Http/Root. - The Doctrine mapping: a
Catalogmapping in doctrine.yaml, onsrc/Catalog/Infrastructure/Persistence/Doctrine/Entity, like theTextone, and the DBAL type of each of its identifiers underdoctrine.dbal.types, likeaccount_id. - Deptrac:
'Catalog'added to$contextsinphil-dev.php, which gives it its three layers and both kinds of rules.
Accounts and administration π
The context Account holds the member accounts. User
is a Doctrine entity of its infrastructure, identified by an AccountId, which is
also how phil/privacy-bundle knows the member, never by their email address. The sign-up goes through the command bus: SignUpCommand, its handler, and the
port Accounts of the domain, whose adapter hashes the password and keeps the account.
| Page | Path | What it does |
|---|---|---|
| Sign-up | /fr/signup, /en/signup |
A user name, an email address and a password of 12 characters or more, typed twice; both the name and the address are unique. A valid form creates the account and signs it in. |
| Sign-in | /fr/login, /en/login |
The form login of Symfony, with a CSRF token; five failed attempts a minute per user name and address are allowed. |
| Account | /fr/account, /en/account |
The account of the member, a link to their privacy choices and the button that signs them out. |
| Sign-out | /fr/logout, /en/logout |
By POST with a CSRF token only: a link or an image never signs anyone out. |
| Privacy choices | /fr/privacy-choices, /en/privacy-choices |
The export of the member's data, the deletion of their account after thirty days, the consent; the deletion asks for the password again when the session is not recent. |
| Administration | /admin |
For ROLE_ADMIN only, which includes ROLE_USER: the accounts, listed and shown, never created nor edited there, the errors of the site, and the feature flags under /admin/flags. |
| Account as JSON | /api/accounts/{account} |
For ROLE_ADMIN only: the identifier, the user name, the roles and the creation date of an account, never its email address nor its password; anything but the identifier of an account is a 404. |
The firewall checks the account again each time it is refreshed from the session (user_checker_on_refresh: true), so
a changed or disabled account is signed out on its next request. The session keeps a crc32c hash of the password hash,
never the hash itself; a changed password signs the other sessions out. Impersonation stays off; if a site turns it
on, only by POST with a CSRF token, never by a query parameter.
castor load-fixtures resets the SQLite database and loads two named accounts and ten more members, for development
only:
| User name | Password | Roles |
|---|---|---|
admin |
admin-password |
ROLE_ADMIN |
member |
member-password |
ROLE_USER |
A context adds its own pages to the administration with a CRUD controller in its Infrastructure/Http/Admin/ folder,
and a link in the menu of the DashboardController, by
the name EasyAdmin gives its routes. Its personal data take part in the export and the erasure of a member with a
PersonalDataExporter and a PersonalDataEraser, as AccountPersonalData does.
To sign members in with an identity provider through OpenID Connect instead of passwords, replace the form login with
phil/identity-client-bundle, as its
installation guide shows: the firewall keeps user_checker_on_refresh: true, and the sign-up, the passwords and their
fixtures go.
Feature flags and circuit breakers ποΈ
A new feature ships behind a flag of phil/feature-flags-bundle,
declared off in phil_feature_flags.yaml and turned on by an administrator
under /admin/flags, with a reason written to the feature_flags log channel; the states live in the database. A
third party that fails is no longer called for a while, thanks to a circuit of
phil/circuit-breaker-bundle around its
HTTP client, declared in phil_circuit_breaker.yaml; each circuit also has
a flag that forces it open. The examples of the template are the flag text.slug-page, which guards the page
/fr/slug and its link on the home page, and the circuit http.example, around the scoped client example.client.
What is wired, where a flag is read in the layers, and how to add a flag or a circuit:
doc/feature-flags-and-circuit-breakers.md.
Accessibility βΏ
Every page of the site is checked by phil/accessibility-check
on each run of the tests: AccessibilityTest requests the pages of the route
smoke test, in French and in English, as a visitor and as an administrator, and fails on an accessibility error; a
warning is written out and passes. A route or a rule is left out in the test itself, with its reason.
To check what the authors of a site publish β a validator constraint on a form, a guard that holds back a publication in a workflow β see doc/accessibility.md. Nothing of it is wired by default.
Before going live π
The template starts with nothing that claims what no one has checked. Before a site is public:
- The secret: set
APP_SECRETin the environment of the server, or in the Symfony secrets. - The legal documents: fill the identity of the site in
phil_legal_notices.yaml, adapt the bodies in
legal/, then publish each version (apublished_atdate,stateremoved). Until then/fr/legaland/fr/privacyanswer 404.bin/console phil:legal-notices:checkreports what a body lacks. - The accessibility statement: write its first version once the site is evaluated; until then its page answers 404 and the footer does not link to it.
- The contact form: replace the example sender and recipient in
phil_contact_form.yaml and set
MAILER_DSN. security.txt: replace the contact in phil_well_known.yaml and push its expiry date back, at most a year ahead.- Several servers: give the lock (
LOCK_DSN),cache.appandcache.circuitsa store every server shares, and removesingle_serverfrom phil_browser_security.yaml, phil_error_tracking.yaml and phil_circuit_breaker.yaml. - The accounts: never load the fixtures, whose passwords are public; create the first administrator by signing up,
then give the account
ROLE_ADMINin the database. - Personal data: set
APP_PUBLIC_ORIGINto the address of the site, run the account deletions that are due withbin/console messenger:consume scheduler_phil_privacy(withsymfony/scheduler) orbin/console phil:privacy:deletionsfrom cron, and declare in config/privacy/cookies.yaml every cookie the site adds. - The errors: set
APP_RELEASEto the version that runs, and purge the old events withbin/console phil:error-tracking:purgefrom cron. - The third parties: rename the example client
example.clientand its circuithttp.exampleafter the third party the site calls, or remove them withEXAMPLE_API_URL; keep the lines of thefeature_flagslog channel, the audit trail of the flags.
Optional steps π§©
Sign-in by OpenID Connect
The accounts sign in with a password by default. To sign them in with the identity provider of your choice:
composer require phil/identity-client-bundle
Replace form_login in security.yaml with the authenticator of the bundle, keep
user_checker_on_refresh: true, and import the routes of oidc_login as the
installation guide of the bundle
shows.
Tailwind instead of PHIL UX CSS
The template is dressed by phil-ux and the PHIL UX kit. A site that prefers Tailwind CSS takes the Shadcn kit of the
Symfony UX Toolkit and phil/ux-kit-shadcn, the PHIL UX recipes in Tailwind under the same names and props, with
symfonycasts/tailwind-bundle on AssetMapper: doc/tailwind.md gives what to remove, what to add,
the commands and what changes in the templates.
More recipes of the PHIL UX kit
The recipes in templates/components/ β Badge, Button, Card, Table, ThemeSwitcher β are copies the site
owns. Others come from the kit with the Symfony UX Toolkit:
bin/console ux:install accordion --kit=github.com/parler-haut-interagir-librement/ux-kit --no-interaction
Tasks π§°
castor lists every task. The tests, the coverage, the lints, the fixers, the local continuous integration and the git
hooks are the common tasks of phil/dev-tools, which
castor.php imports from vendor/phil/dev-tools/resources/castor/tasks.php and sets with its
PHIL_CASTOR constant; the file keeps the template's own tasks β servers, database, environments, test:schema and
lint:doctrine. Run composer install before the first task. The main ones:
| Task | What it does |
|---|---|
castor start, castor stop |
The Symfony binary's web server with SQLite and its migrations. |
castor up, castor down |
FrankenPHP in worker mode, PostgreSQL and Mailpit, with Docker Compose. |
castor secret |
A random APP_SECRET in .env.local, unless it holds one. |
castor reset-database |
The SQLite database reset and migrated. |
castor load-fixtures |
The SQLite database reset and migrated, with the accounts admin and member and ten more. |
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:suite <name> runs any suite of phpunit.dist.xml. |
castor test:e2e |
The E2E suite in a real browser, Chrome driven by Panther: it proves that the JavaScript of the pages runs under the Content Security Policy. 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:next |
The tests on the next PHP version, in its Docker image. |
castor test:schema |
The migrations on a fresh SQLite database, then its schema compared with the Doctrine mapping. |
castor coverage |
The HTML coverage report in var/coverage/, and its threshold. |
castor infection |
Mutation testing. |
castor lint |
Every lint and the static analysis, then lint:doctrine. |
castor fix |
Rector, PHP-CS-Fixer, Twig-CS-Fixer, Biome and composer-normalize. |
castor ci |
The continuous integration, locally: coverage, every lint, then test:schema. |
castor hooks |
The git hooks: the fast checks on the staged files before each commit. |
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, lint:doctrine |
The YAML files (config/ among them), the container and the Doctrine mapping. |
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 layers of DDD and the libraries each may use. |
What it doesn't ship π
- No deployment file: each site brings its own.
- No sign-in by an identity provider: it is an optional step.
- No published legal document and no accessibility statement: the site publishes them once they say something true.
- No Node.js build: AssetMapper serves the JavaScript and phil-ux as they are.
References π
- Introducing the MicroSymfony application template (strangebuzz.com)
- MicroSymfony 8: ready for the LTS promise (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)
- Messenger: sync and queued message handling (symfony.com)
- Localized routes (symfony.com)
- The Symfony Framework Best Practices (symfony.com)
Others βProclaim Honestly, Interact Liberallyβ Skeletons π©»
- MicroSymfony (
phil/microsymfony): the micro template, with no database, Pico CSS, Stimulus and Turbo, Castor, the tests and quality gates. - WebSymfony (
phil/websymfony): MicroSymfony and what a web application needs β Doctrine, member accounts, security headers, an administration, English and French β, in the usual layout of Symfony and on Pico CSS. - ApiSymfony (
phil/apisymfony): an API with API Platform, Castor, the tests and quality gates.
Contributing π€
See CONTRIBUTING and the Code of Conduct.
Security π§―
See SECURITY.
Credits π
- Philippe Gamache, maintainer, for Parler Haut, Interagir Librement
- COil, author of strangebuzz/MicroSymfony, and its contributors
- All the contributors of WebSkeleton
License βοΈ
The MIT License, with the attribution to the original repository it asks for. See the license file.
Built with WebSkeleton π οΈ
- IRL Assemble Online
- La Page Γ Melkor
- Parler Haut, Interagir Librement
- RPG Assemble Online
- TiltTek
- TTRPG Maker