anourvalar / config-helper
Helper functions over Laravel config
Installs: 8 372
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- laravel/framework: ^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.26
- phpstan/phpstan: ^1.10
- psalm/plugin-laravel: ^2.8
- squizlabs/php_codesniffer: ^3.7
README
Installation
composer require anourvalar/config-helper
Usage
Config example
// 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], ], ];
Get filtered keys of config
\ConfigHelper::keys('example.user_role', ['super_user' => true]); // ['admin', 'maintainer']
Get singleton key
\ConfigHelper::key('example.user_role', ['register_via_form' => true]); // 'user'
HTML select
echo '<select>' . \ConfigHelper::toSelect('example.user_role') . '</select>';