1. Go to this page and download the library: Download owenbush/static-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/ */
owenbush / static-settings example snippets
declare(strict_types=1);
namespace YOURNAMESPACE;
use StaticSettings\BaseStaticSettingInterface;
enum Environment: string implements BaseStaticSettingInterface {
case Development = 'development';
case Staging = 'staging';
case Production = 'production';
}
use StaticSettings\StaticSettings;
StaticSettings::registerSetting(Environment::class);
// Set the environment
StaticSettings::set(Environment::class, Environment::Production);
// Get the current environment
$environment = StaticSettings::get(Environment::class);
if ($environment === Environment::Production) {
// Do production-specific things
}
// Set up some settings.
$settings = [
Environment::class => Environment::Production,
SomeOtherClass:class => SomeOtherClass::Value,
];
// Set multiple settings at once.
StaticSettings::setMultiple($settings);
// Retrieve the environment setting.
$environment = StaticSettings::get(Environment::class);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.