1. Go to this page and download the library: Download tzunghaor/settings-bundle 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/ */
// src/Settings/BoxSettings.php
namespace App\Settings;
use Tzunghaor\SettingsBundle\Attribute\Setting;
class BoxSettings
{
/**
* @var int
*/
public $padding = 0;
/**
* @var string[]
*/
#[Setting(enum: ["bottom", "top", "left", "right"])]
public $borders = [];
}
use App\Settings\BoxSettings;
use Tzunghaor\SettingsBundle\Service\SettingsService;
class MyService
{
// ...
public function __construct(SettingsService $settingsService)
{
/**
* declaring variable type for auto-complete support in IDE
* @var BoxSettings $boxSettings
*/
$boxSettings = $settingsService->getSection(BoxSettings::class);
$doublePadding = $boxSettings->padding * 2;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.