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 Setting

Laravel Setting Laravel Package

akaunting/laravel-setting

Persistent settings for Laravel with database and/or JSON drivers. Includes helper, facade, and Blade directive, supports encryption, caching, auto-save, extra columns, and custom tables/files. Can override Laravel config values for production-friendly tweaks.

View on GitHub
Deep Wiki
Context7

Persistent settings package for Laravel

Frequently asked questions about Laravel Setting
How do I install and set up akaunting/laravel-setting in a Laravel 9+ project?
Run `composer require akaunting/laravel-setting`, publish the config with `php artisan vendor:publish --tag=setting`, and run migrations (`php artisan migrate`). Laravel 9+ auto-discovers the package, so no manual provider registration is needed unless using facades.
Can I use this package to manage tenant-specific settings in a multi-tenant SaaS?
Yes, the package supports custom columns like `tenant_id` in the settings table. Configure it in the `config/setting.php` file under `table_columns` and use `Setting::forTenant($tenantId)->get('key')` to scope settings by tenant.
Does this package support caching for better performance?
Yes, you can enable caching via `Setting::cache()` or configure it in `config/setting.php` under `cache`. It uses Laravel’s cache driver (e.g., Redis, Memcached) to reduce database load for read-heavy workloads.
How do I override Laravel’s default config values (e.g., `app.name`) without modifying `config/app.php`?
Add the config keys to the `override` array in `config/setting.php`. For example, `app.name` can be overridden by setting `'app.name' => 'My Custom App'` in the config. The package will automatically merge these values during runtime.
Is there a way to encrypt sensitive settings (e.g., API keys) stored in the database?
Yes, enable encryption in `config/setting.php` by setting `'encrypt' => true`. The package will automatically encrypt/decrypt values using Laravel’s encryption services (e.g., AES-256).
How do I handle nested settings (e.g., `app.theme.colors.primary`) or complex data types (arrays, objects)?
Use dot notation for nested keys (e.g., `Setting::set('app.theme.colors.primary', '#FF0000')`). The package serializes arrays/objects to JSON by default. For custom casting (e.g., booleans, integers), use Laravel’s `casts` property in the settings model.
What’s the best way to test this package in unit/integration tests?
Mock the `Setting` facade or service provider in your tests. Use `Setting::fake()` (if supported) or manually bind a mock to the container. For example, in a test case: `$this->app->instance('setting', MockSetting::class);`.
Can I use this package with Laravel Nova for an admin interface to manage settings?
Yes, the package integrates seamlessly with Nova. Create a Nova resource for the `settings` table or use the `Setting` facade in Nova tool actions. For a UI, you can also build a custom Nova card or tool using the `setting()` helper.
What happens if I need to roll back a migration that conflicts with the settings table?
If the settings table already exists, run `php artisan migrate:rollback` first, then adjust the migration file (e.g., rename the table or add columns) before re-running migrations. The package includes schema checks to avoid conflicts.
Are there alternatives to this package for Laravel settings management?
Alternatives include `spatie/laravel-settings` (more feature-rich, e.g., groups, validation), `beberlei/attributes` (for attribute-based settings), or `laravel/config` (for basic config overrides). Choose based on needs: this package excels in simplicity and DB/JSON flexibility.
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.
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours