zeyad82/laravel-envx is a Laravel package for laravel custom env with validation.
It currently has 0 GitHub stars and 358 downloads on Packagist (latest version v1.2.1).
Install it with composer require zeyad82/laravel-envx.
Discover more Laravel packages by zeyad82
or browse all Laravel packages to compare alternatives.
Last updated
Laravel Envx is a custom php environment file as an array so that it can have associative and multidimensional arrays with validation rules in order to avoid any unexpected behaviour especially if there are several instances of the project.
This has been tested with laravel 5.6 and 5.7.
required_ifany to apply rules to an atrribute if another array attribute has a given valueJust like laravel env => envx('attribute', 'default')
Via Composer:
composer require zeyad82/laravel-envx
If you don't use auto-discovery, add the service provider your config/app.php:
Zeyad82\LaravelEnvx\LaravelEnvxServiceProvider::class,
php artisan vendor:publish --tag="laravel-envx"
This will publish config/envx-validator.php and envx.example.php then run
cp envx.example.php envx.php
If you will have different envx.php, add envx.php to .gitignore in your project root
If you will use envx in config files, the only way I found is to append the follwing to bootstrap/app.php after ExceptionHandler
$app->singleton('envx', function ($app) {
return new Zeyad82\LaravelEnvx\EnvxService;
});
<?php
// config/envx-validator.php
return [
'ARRAY' => 'required|array',
'ARRAY.*' => 'required|in:val1,val2,val3',
'ATTRIBUTE' => 'required_ifany:ARRAY,val1|url',
]
<?php
return [
'ARRAY' => 'required|array',
'ARRAY.*' => 'required|in:val1,val2,val3',
'ATTRIBUTE' => 'required_ifany:ARRAY,val1|url',
];


If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License for more information.