1. Go to this page and download the library: Download rasuvaeff/yii3-settings-ui 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/ */
rasuvaeff / yii3-settings-ui example snippets
use Rasuvaeff\Yii3SettingsUi\SettingsRoutes;
return [
'rasuvaeff/yii3-settings' => [
'definitions' => [
// Presentation metadata (label/group/help/choices/readonly) lives on the
// definition itself — a single source of truth, no parallel map.
'mail.from' => ['type' => 'string', 'default' => '[email protected]', 'group' => 'Mail'],
'orders.max_items' => ['type' => 'int', 'default' => 100, 'label' => 'Max items per order', 'group' => 'Orders'],
'billing.stripe_key' => ['type' => 'string', 'secret' => true, 'label' => 'Stripe secret key', 'group' => 'Billing'],
],
],
SettingsRoutes::PARAM_KEY => [
'route_prefix' => '/admin/settings',
'layout' => null,
'views' => [
'list' => '/abs/path/to/settings-list.php',
'edit' => '/abs/path/to/settings-edit.php',
],
'middlewares' => [
'all' => [AuthMiddleware::class],
],
// RequestBodyParser is added automatically to POST routes (update, reset).
// Set 'body_parser' => false if your pipeline already applies it globally.
],
];
use Rasuvaeff\Yii3Settings\{SettingsInspector, WritableSettingsProvider};
use Rasuvaeff\Yii3SettingsDb\DbSettingsProvider;
return [
WritableSettingsProvider::class => DbSettingsProvider::class,
SettingsInspector::class => DbSettingsProvider::class,
];
use Rasuvaeff\Yii3SettingsUi\SettingsRoutes;
use Yiisoft\Router\Group;
Group::create(prefix: '/admin')->routes(
...SettingsRoutes::fromParams($params),
);