PHP code example of anourvalar / config-helper

1. Go to this page and download the library: Download anourvalar/config-helper 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/ */

    

anourvalar / config-helper example snippets


// config/example.php

return [
    'user_role' => [
        'admin' => ['title' => 'Administrator', 'super_user' => true],
        'maintainer' => ['title' => 'Maintainer', 'super_user' => true],
        'moderator' => ['title' => 'Moderator'],
        'user' => ['title' => 'User', 'register_via_form' => true],
    ],
];

\ConfigHelper::keys('example.user_role', ['super_user' => true]); // ['admin', 'maintainer']

\ConfigHelper::key('example.user_role', ['register_via_form' => true]); // 'user'

echo '<select>' . \ConfigHelper::toSelect('example.user_role') . '</select>';