1. Go to this page and download the library: Download rdcstarr/laravel-settings library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rdcstarr / laravel-settings example snippets
// Get a setting (returns false if not found)
$name = settings()->get('app.name', 'Default Name');
// Set a setting (returns true on success, false if unchanged or failed)
settings()->set('app.name', 'My Application');
// Check if a setting exists
if (settings()->has('app.name')) {
// Setting exists
}
// Delete a setting (returns true if deleted, false otherwise)
settings()->delete('old.setting');
// Get all settings
$all = settings()->all(); // Collection
// Set multiple settings at once
settings()->setMany([
'app.name' => 'My Application',
'app.theme' => 'dark',
'app.language' => 'en',
'mail.driver' => 'smtp',
'mail.host' => 'smtp.example.com',
]);
// Quick access with helper
$theme = settings('app.theme', 'light');
// Same as
$theme = settings()->get('app.theme', 'light');
use Rdcstarr\Settings\Facades\Settings;
Settings::set('app.name', 'My App');
$name = Settings::get('app.name', 'Default');
Settings::delete('old.setting');
// Clear the cache (returns true on success)
settings()->flushCache();