PHP code example of bbprojectnet / laravel-rules

1. Go to this page and download the library: Download bbprojectnet/laravel-rules 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/ */

    

bbprojectnet / laravel-rules example snippets


return [
	'attribute' => [new Base64()],
];

return [
	'attribute' => [new EnumCase(Color::class)], // any enum case
	'attribute' => [new EnumCase([Color::Red, Color::Blue])], // selected enum cases
];

return [
	'attribute' => [new Extension(['jpg', 'png', 'gif'])],
];

$rule = new Extension(['jpg', 'png']);

return [
	'attribute' => [new ManyOf($rule)],
	'attribute' => [(new ManyOf($rule))->delimeter('|')], // with custom delimeter
];