PHP code example of azaharizaman / nexus-settings-management
1. Go to this page and download the library: Download azaharizaman/nexus-settings-management 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/ */
azaharizaman / nexus-settings-management example snippets
use Nexus\SettingsManagement\Coordinators\SettingsCoordinator;
use Nexus\SettingsManagement\DTOs\Settings\SettingUpdateRequest;
// Update a single setting
$result = $settingsCoordinator->updateSetting(new SettingUpdateRequest(
key: 'app.timezone',
value: 'Asia/Kuala_Lumpur',
tenantId: 'tenant-123',
reason: 'Update timezone for new region',
));
// Bulk update settings
$result = $settingsCoordinator->bulkUpdateSettings(new BulkSettingUpdateRequest(
settings: [
'app.timezone' => 'Asia/Kuala_Lumpur',
'app.locale' => 'en-MY',
],
tenantId: 'tenant-123',
));
use Nexus\SettingsManagement\Coordinators\FeatureFlagCoordinator;
use Nexus\SettingsManagement\DTOs\FeatureFlags\FlagCreateRequest;
use Nexus\SettingsManagement\DTOs\FeatureFlags\FlagType;
// Create a feature flag
$result = $featureFlagCoordinator->createFlag(new FlagCreateRequest(
key: 'new_dashboard',
name: 'New Dashboard',
description: 'Enable the new dashboard UI',
type: FlagType::BOOLEAN,
defaultValue: false,
tenantId: 'tenant-123',
));
// Evaluate feature flags
$result = $featureFlagCoordinator->evaluateFlags(new FlagEvaluationRequest(
tenantId: 'tenant-123',
flagKeys: ['new_dashboard', 'beta_features'],
userId: 'user-456',
));
use Nexus\SettingsManagement\Coordinators\FiscalPeriodCoordinator;
use Nexus\SettingsManagement\DTOs\FiscalPeriod\CalendarConfigRequest;
use Nexus\SettingsManagement\DTOs\FiscalPeriod\PeriodType;
// Configure fiscal calendar
$result = $fiscalPeriodCoordinator->configureCalendar(new CalendarConfigRequest(
tenantId: 'tenant-123',
fiscalYearStart: new \DateTime('2026-01-01'),
periodType: PeriodType::MONTHLY,
namingConvention: 'FY{{year}}-P{{period}}',
yearEndClosing: true,
));