Laravel Options Package

Laravel Options Package

The Laravel Options package from Appstract is a global database key-value options store for Laravel. This package uses a simple options database table with a key and value field and an Option model available via a service provider.

Related: Storing Global Application Settings

Laravel Options has some helpers and a Facade for working with the options table, along with a common public API for creating, getting, setting, and deleting options by key:

// Get an option
option('someKey');

// Set option
option(['someKey' => 'someValue']);

// Check the option exists
option_exists('someKey');

The package ships with a console command to set global options via the command line:

php artisan option:set site_name "Laravel News"

Laravel Options takes away some boilerplate that you might have in your app to replicate a simple key-value store, but doesn’t have much functionality beyond setting simple key-values and you’ll be responsible for any data transformations.

For complete installation instructions check out appstract/laravel-options on GitHub.


Filed in: Laravel Packages


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Software Engineer Lead (PHP)
Remote
CivicPlus, LLC
Full-time Senior Web Developer
Detroit, MI
Wayne State University
Senior Software Engineer
Sydney, Australia
FoodByUs
Full Stack Engineer
Remote or Medford, Oregon
Empire Medical
Laravel Developer (fulltime - Dutch only)
Netherlands
Qbixx | Webservices
Full Stack or Back-End Developer
Alexandria, VA; Tallahassee, FL; Orlando, FL
Marketing for Change
Senior Quality Assurance Engineer
Remote
Bisnow Media