phil / settings-bundle
Settings people change themselves, for Symfony: declared by packages and the application, read typed with their default, stored per person and key, a preferences centre and site settings in Twig forms with migrations and a preview before saving, and display preferences applied as data attributes on
Package info
github.com/parler-haut-interagir-librement/settings-bundle
Type:symfony-bundle
pkg:composer/phil/settings-bundle
Requires
- php: >=8.5
- ext-mbstring: *
- doctrine/dbal: ^4.5
- psr/clock: ^1.0
- psr/container: ^2.0
- psr/event-dispatcher: ^1.0
- symfony/config: ^8.2
- symfony/console: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/form: ^8.2
- symfony/http-foundation: ^8.2
- symfony/http-kernel: ^8.2
- symfony/routing: ^8.2
- symfony/security-core: ^8.2
- symfony/service-contracts: ^3.6
- symfony/translation-contracts: ^3.6
- twig/twig: ^3.21
Requires (Dev)
- ext-pdo: *
- doctrine/doctrine-bundle: ^3.3
- doctrine/orm: ^3.7
- phil/notifications-bundle: ^0.1@dev
- phil/privacy-bundle: ^0.1@dev
- phpunit/phpunit: ^13.4
- psr/log: ^3.0
- symfony/asset-mapper: ^8.2
- symfony/clock: ^8.2
- symfony/event-dispatcher: ^8.2
- symfony/framework-bundle: ^8.2
- symfony/security-bundle: ^8.2
- symfony/security-csrf: ^8.2
- symfony/translation: ^8.2
- symfony/twig-bridge: ^8.2
- symfony/twig-bundle: ^8.2
- symfony/yaml: ^8.2
Suggests
- doctrine/orm: To add the table to the schema the ORM generates, for doctrine:migrations:diff
- phil/notifications-bundle: To provide the notification preferences of its recipients from the preferences centre
- phil/privacy-bundle: To export and erase a person's settings with the rest of their account
- phil/ux-css: To dress the settings pages and to apply the display preferences the page's root element carries
- symfony/asset-mapper: To serve the Stimulus controller without a build step
- symfony/security-bundle: To name the current user and to check the roles of the site's settings
- symfony/stimulus-bundle: To apply a display preference as soon as it is chosen
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-15 03:41:08 UTC
README
Settings people change themselves, for Symfony.
phil/settings-bundle keeps the settings each user changes — their preferences — and those of the site, which the users of a role change. Packages and the application declare them, by configuration or attribute; the bundle reads them typed with their default, stores what differs from it one row per person and key, and generates a page of forms section by section. Its display preferences — colour scheme, motion, contrast, text size — are kept for visitors too, in a strictly necessary cookie, and written on the page's root element, where the stylesheet applies them as it applies the system's media queries.
Status
| Part | State |
|---|---|
Declarations by configuration and attribute, ordered by before and after |
Implemented and tested |
| Typed reading with the default, saving, restoring, forgetting, change events | Implemented and tested |
| DBAL storage, one read per subject and request, reset between requests | Implemented and tested |
| The preferences and the site's settings, forms by section, CSRF, English and French | Implemented and tested |
| Display preferences for users and visitors, root attributes, Stimulus controller | Implemented and tested |
| The notifications bundle's preferences, the privacy bundle's export and erasure | Implemented and tested |
| Migrations of the stored values — rename, convert, default changed, remove —, versioned, by a command | Implemented and tested |
| The preview of a section before saving | Implemented and tested |
| The site's settings behind SecurityBundle, in the functional suite | Implemented and tested |
| The Flex recipe: the bundle, its configuration and its routes | Written in recipe/0.1, for the recipes repository of PHIL |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, the recipe, the tables, the routes and the root element. |
| Configuration | Every option, with an example. |
| Settings | Declaring, ordering, reading, writing, and the change events. |
| The settings pages | The preferences and the site's settings, their forms, preview and template. |
| Display preferences | Theme, motion, contrast and text size, on the page and for visitors. |
| Notifications and privacy | The notification preferences, and the export and erasure of a person's settings. |
| Migrations | Renames, type changes and defaults of a declaration that evolved, applied once by a command. |
| Storage | The table, the reads of a request, and the worker reset. |
| Extension points | The ports, the declarations, the services and the events. |
| Testing | The bundle's tests, its benchmarks and its fuzz target. |
| Reference | Every class and file of the bundle. |
Quick start
// config/bundles.php Phil\SettingsBundle\PhilSettingsBundle::class => ['all' => true],
# config/packages/phil_settings.yaml phil_settings: sections: author: { before: [notifications] } settings: author.signature: { type: text, section: author, max_length: 120 } site.registrations_open: { type: boolean, default: true, scope: site }
<html lang="{{ app.request.locale }}" {{ phil_document_attributes() }}>
$settings->string('author.signature'); // the current user's, or the default $settings->save(Subject::user($id), ['author.signature' => 'Ada']);
Requirements
PHP 8.5 or later, Symfony 8.2 or later with FrameworkBundle and TwigBundle, and Doctrine DBAL.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.