statelyworld/laravel-settings

A minimal Laravel package to manage key-value settings. A global application settings management package for Laravel, similar to WordPress options

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/statelyworld/laravel-settings

v1.0.0 2025-05-15 08:39 UTC

This package is auto-updated.

Last update: 2025-12-20 06:43:40 UTC


README

A minimal and reusable Laravel package to store key-value settings in your database.

📦 Installation

Require the package via Composer:

composer require statelyworld/laravel-settings

If you encounter the error:

Could not find a version of package statelyworld/laravel-settings matching your minimum-stability (stable)...

Add the following to your root project's composer.json before requiring again:

"minimum-stability": "dev",
"prefer-stable": true

✅ What to Do After Installation?

1. Run Migrations

Option 1: Auto-Load Migrations (Recommended)

Run the following to create the settings table:

php artisan migrate

Option 2: Publish Migration (Optional)

If you prefer to manage the migration file in your own project:

php artisan vendor:publish --tag=laravel-settings-migrations
php artisan migrate

🚀 Usage Example

Set a Value

use StatelyWorld\LaravelSettings\Models\Setting;

// Store a setting
Setting::set('site_name', 'My Awesome Website');

Get a Value

use StatelyWorld\LaravelSettings\Models\Setting;

// Retrieve the setting or use a default if not found
$siteName = Setting::get('site_name', 'Default Site Name');

🧑‍💻 Example Use Cases

  • Store API keys or tokens
  • Enable/disable site features (maintenance mode, promotions)
  • Site-wide text configurations (site name, footer text)
  • Track process IDs or timestamps
  • Store any small settings without adding extra config files

📂 Package Structure

src/
└── Models/
    └── Setting.php
└── SettingServiceProvider.php
database/
└── migrations/
    └── create_settings_table.php
composer.json
README.md

✅ Laravel Version Compatibility

Laravel Version Supported
9.x
10.x
11.x

📝 License

This package is open-sourced software licensed under the MIT license.

🙏 Contributing

We welcome contributions. Please fork the repository, make changes, and submit a pull request.

👨‍💻 Maintainer