PHP code example of yaroslawww / laravel-blocklist-check

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

    

yaroslawww / laravel-blocklist-check example snippets


use LaraBlockList\Contracts\CanBeInBlocklist;
use LaraBlockList\Models\HasBlocklist;

class User /* ... */ implements CanBeInBlocklist
{
    use HasBlocklist;

    /**
     * @inheritDoc
     */
    public function getBlocklistProcessor(array $args = []): BlocklistProcessor
    {
        return new BlocklistProcessor([
            new RegexChecker([ '/\.ru$/', ], [ 'email' ]),
            new RegexChecker([ /* contain cyrillic */ '/[А-Яа-яЁё]+/u', ], [ 'name', ]),
        ]);
    }

    // ...
}
bash
php artisan vendor:publish --provider="LaraBlockList\ServiceProvider" --tag="config"
shell
php artisan blocklist:check "\App\Models\User"
# or
php artisan blocklist:check "\App\Models\User" 123
# or
php artisan blocklist:check "\App\Models\User" --from=2020-01-01 --queue=default