I wrote this quite some time back
http://novate.co.uk/using-spatie-valuestore-to-hold-frequently-used-settings/
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am building an SPA that requires a global settings and I happen to come across a package that handles this kind of data. I wanted to try the settings package from Spatie and I want to know if anyone here had experience using the package? I was kind of confused how I am going to fetch the all the settings data aside from DB::table('settings')->get(). I know it's kind of a dumb question, I've read the instructions from their Github repo but somehow confused. I can't even find an article about it. If someone knows how to implement it, thank you in advance for the help.
api.php:
Route::get('settings', 'API\v1\SettingController@index')->name('settings');
SettingController.php
public function index()
{
return response(DB::table('settings')->get(), 200);
}
GeneralSettings.php
<?php
namespace App\Classes;
use Spatie\LaravelSettings\Settings;
class GeneralSettings extends Settings
{
public string $site_name;
public bool $site_active;
public static function group(): string
{
return 'general';
}
public static function repository(): ?string
{
return 'settings';
}
}
Please or to participate in this conversation.