1. Go to this page and download the library: Download mbsoft31/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/ */
mbsoft31 / settings example snippets
return [
// Define default paths or custom settings here
];
use MBsoft\Settings;
// Initialize settings
$settings = new Settings([
'app.name' => 'My Application',
'app.env' => 'local',
]);
// Save settings to a file
$settings->saveToFile(storage_path('settings.json'), \MBsoft\Settings\ConfigFormat::JSON);
// Load settings from a file
$loadedSettings = Settings::loadFromFile(storage_path('settings.json'), \MBsoft\Settings\ConfigFormat::JSON);
echo $loadedSettings->get('app.name'); // Outputs: "My Application"