ongr/settings-bundle
Symfony bundle for managing configurable application settings, with services for storing, retrieving, and editing settings. Integrates with ONGR’s Elasticsearch stack to persist settings and expose them to your application.
composer require ongr/settings-bundle — target the 1.0.0 line, the first stable major release. It pairs with ongr/elasticsearch-bundle, so you will likely pull that in too; the settings themselves live in an Elasticsearch index, not a relational table.AppKernel::registerBundles). The 1.0.0 release is a stabilization of the 2016-era codebase, so expect old-style bundle registration rather than Symfony Flex auto-wiring. (This is a Symfony bundle — in a Laravel app you would have to build a bridge or cherry-pick the pieces, not just composer require it.)ongr_settings key: point it at your ES manager and declare your setting keys/defaults. Read the bundle's own DependencyInjection/Configuration.php first — the config shape is the authoritative documentation, and the README is thin.ongr_settings.settings_manager) and read a SettingsCollection:$settings = $this->get('ongr_settings.settings_manager')->getSettings('default');
$limit = $settings->get('pagination_limit');
SettingsManager (read/write API), SettingsCollection (the value object you actually touch), the Settings ES document (storage shape), and the bundled console command / REST controller for bulk updates. Since 1.0.0 also look at the newly added events — they are now a first-class part of the public API and the cleanest integration seam.SettingsManagerInterface (or the ongr_settings.settings_manager service) into your services so you can swap/mock it in tests. Do not sprinkle $container->get(...) calls through controllers.getSettings($domain) at the edge of a request (a request listener or a controller base class) and pass the SettingsCollection down. Fall back to a default domain when a specific one is missing.updateSettings(array $values, $domain), which persists the whole settings document. Build the array from the current collection plus your changes; there is no field-level patch API.updateSettings. Because writes hit ES, wrap the call in a transaction-like try/catch and flush any cache afterward.ongr:settings:update-style command for initial population or migrations, and wire it into your deploy pipeline after the ES index is created.SettingsCollection (e.g., in a Redis/Symfony cache provider keyed by domain) and invalidate on write. A small decorator around the manager that reads from cache and delegates writes to ES is the cleanest integration.SettingsCollection is a simple array-backed object, unit-test consumers of settings without ES at all. For the manager, mock the interface or point at an in-memory/test ES index.SettingsCollection, so get() returns null silently. Always check ES directly (GET <index>/_search) when a value "disappears."updateSettings. Invalidate synchronously on write; don't rely on TTL alone in admin flows.(int), filter_var(..., FILTER_VALIDATE_BOOLEAN)) rather than trusting the stored type.vendor/.ongr_elasticsearch logger verbosity and watch the actual query/response when debugging a read. Also dump the raw Settings document to confirm the domain key you wrote matches the one you read.SettingsManagerInterface, provide a custom settings provider/cache, and hook the settings-update events. Avoid patching the bundle in vendor/; fork it (MIT license permits this) or copy the small pieces you need into your app.ongr:settings:update runs against ES, it must run after index creation and after the new code is deployed, otherwise the command may use stale config or write to a missing index.How can I help you explore Laravel packages today?