Skip to content

laravel-ready/blacklist-whitelist

Repository files navigation

BlacklistWhitelist

BlacklistWhitelist

Stable Version Unstable Version Total Downloads License

📂 About

Simple domain and email blacklist/whitelist package...

📦 Installation

Get via composer

composer require laravel-ready/blacklist-whitelist

⚙️ Configs

php artisan vendor:publish --tag=blacklist-whitelist-config

Migrations

# publish migrations
php artisan vendor:publish --tag=blacklist-whitelist-migrations

# apply migrations
php artisan migrate --path=/database/migrations/laravel-ready/blacklist-whitelist

📝 Usage

use LaravelReady\BlacklistWhitelist\Enums\BlockType;
use LaravelReady\BlacklistWhitelist\BlacklistWhitelist;

// add domain to blacklist or whitelist
BlacklistWhitelist::subject('example.com', BlockType::Blacklist);
BlacklistWhitelist::subject('example.com', BlockType::Whitelist);

// email example
BlacklistWhitelist::subject('[email protected]', BlockType::Blacklist);

// any subject
BlacklistWhitelist::subject('TEST', BlockType::Blacklist);

// check subject
BlacklistWhitelist::isBlocked('example.com');

// check allowed subject
BlacklistWhitelist::isAllowed('example.com');

⚓ Credits

  • This project was generated by the packager.