Skip to content

crhg/laravel-config-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DESCRIPTION

Validate the configuration of the Laravel application.

INSTALL

composer require crhg/laravel-config-validator

USAGE

PREPARE RULES

Implement the Crhg\ConfigValidator\Interfaces\ConfigValidationRuleProvider interface in the service provider class.

Define getConfigValidationRule() function. It has no arguments and returns an array of validation rules. Rules are written in the same way as validation for request.

EXAMPLE

class AppServiceProvider extends ServiceProvider implements ConfigValidationRuleProvider
{
    public function getConfigValidationRule()
    {
        return [
            'app.foo' => 'required',
        ];
    }
}

PERFORM CHECK

Validate the current configuraiton using the rules prepared by executing the config:validate artisan command.

% php artisan config:varidate
app.foo: The app.foo field is required.

It will display a message if there is a problem.

It exists with status 1 if some errors are found.

BUGS

  • Sometimes the wording of a message is odd because the validator for the request is used.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages