Skip to content

Configuration

Config store

The framework provides a central, static key-value store via Config. It is seeded once during bootstrap from config/config.php before anything else runs.

php
// bootstrap/bootstrap.php
Config::set(require NIKOGIN_CONFIG_DIR . 'config.php');

config/config.php

php
return [
    'namespace'      => NIKOGIN_NAMESPACE,   // REST API namespace  e.g. 'ng/v1'
    'slug'           => NIKOGIN_SLUG,        // Plugin slug         e.g. 'nikogin'
    'version'        => NIKOGIN_VERSION,     // Plugin version      e.g. '1.0.0'
    'prefix'         => NIKOGIN_PREFIX,      // DB table prefix     e.g. 'ng'
    'resources_path' => NIKOGIN_DIR . 'resources',
    'build_path'     => NIKOGIN_DIR . 'build',
    'build_url'      => NIKOGIN_URL . 'build',
];

Reading values

php
use Nikogin\Framework\Support\Config;

$version   = Config::get('version');
$namespace = Config::get('namespace');
$custom    = Config::get('my_key', 'default_value');

Adding custom keys

Add any key to config/config.php. It will be available anywhere via Config::get().

php
return [
    // ...existing keys...
    'api_key' => defined('MY_API_KEY') ? MY_API_KEY : '',
];

Reserved keys

KeyUsed by
namespaceRouter — REST API namespace
slugUpdater — DB version option key
versionUpdater, Assets — version string
resources_pathView — base path for dot-notation views
build_pathAssets — path to Vite manifest
build_urlAssets — base URL for compiled assets

Nikogin Framework — WordPress plugin development made simple.