Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel App Settings Laravel Package

qcod/laravel-app-settings

Add a database-backed settings manager with an admin UI to your Laravel app. Define settings sections/inputs in config, edit them via a Bootstrap 4 page (or custom CSS), and access values via the AppSettings facade. Settings are cached for zero SQL reads.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the package via Composer: composer require qcod/laravel-app-settings. Next, publish the config file using php artisan vendor:publish --provider="QCod\AppSettings\AppSettingsServiceProvider" --tag="config", then run migrations to create the settings table. Define your first settings sections and inputs in config/app_settings.php (e.g., app_name, from_email) under the sections array. Finally, create a custom layout view that includes the settings partial (@include('app_settings::_settings')) and visit /settings (or your configured URL) to manage settings via the UI. Use the global helper setting('app_name', 'default') or the AppSettings facade to retrieve values elsewhere in your app.

Implementation Patterns

  • Grouped Settings: Use the setting_group closure in app_settings.php to isolate settings per user or tenant (e.g., return 'user_' . auth()->id();). For dynamic grouping at runtime, call app('app-settings')->setStorageGroup('dynamic-group') before setting/getting values.
  • UI + DB Only Mode: Omit all sections and inputs in app_settings.php to disable the UI while retaining DB persistence. Great for APIs. Remember to set 'remove_abandoned_settings' => false to prevent deletion of undefined keys.
  • Dynamic Select Options: Populate <select> options dynamically via closures, such as querying App\Models\City::pluck('name', 'id')—ideal for multi-tenant or context-aware options.
  • JavaScript Integration: Embed settings in a global window.App.settings object during layout rendering to enable reactive frameworks (e.g., Vue/React) to access config values without additional HTTP requests.
  • Custom Input Types: Extend existing types using the custom_inputs config array to support new field types (e.g., datepickers, color pickers) while maintaining consistency with the built-in validation and rendering flow.

Gotchas and Tips

  • Cache Invalidation: Although settings are cached for performance, changes via setting()->set() or the UI will auto-invalidate the cache. Avoid manually caching setting() results unless you invalidate the cache explicitly after updates.
  • Validation Rules: The rules field supports Laravel validation syntax (e.g., required|email|max:255). For complex rules, use closures to access runtime state (e.g., rules => function() { return request()->user()->isAdmin() ? 'required' : 'nullable'; }).
  • File Upload Pitfalls: When using image or file inputs, ensure your storage/app/public symlink exists (php artisan storage:link). For custom mutator logic, always delete previous file paths to avoid disk clutter.
  • Input Data Types: Use data_type (int, bool, array) to enforce casting on save and retrieval. Without it, values are stored as strings—causing unexpected behavior (e.g., '0' === false).
  • Extensibility: Override the settings controller and view path via config ('setting_page_view', 'controller') to integrate with admin panels (e.g., LaraCraft, Filament) or customize workflows without modifying the vendor code.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport