repat / laravel-validator-emojis
Laravel Validator for Emojis
Installs: 10 348
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: >=7.4
- laravel/framework: ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- steppinghat/emoji-detector: ^1.2
Requires (Dev)
- orchestra/testbench: ^6.17
- phpunit/phpunit: ^9.5
- spatie/ray: ^1.34
README
laravel-validator-emojis is a custom Rule Object / Validator for Laravel that validates emojis using steppinghat/emoji-detector
Installation
$ composer require repat/laravel-validator-emojis
Documentation
use Illuminate\Http\Request; use Repat\LaravelRules\ContainsEmojis; use Repat\LaravelRules\DoesntContainEmojis; // ... public function controllerMethod(Request $request) { // Contains ANY emoji $request->validate([ 'string_to_validate' => new ContainsEmojis(), ]); // Contains ANY of given emoji $request->validate([ 'string_to_validate' => new ContainsEmojis(["🪂", "🤿"]), // $all = false ]); // Contains ALL given emoji $request->validate([ 'string_to_validate' => new ContainsEmojis(emojis: ["🔑", "🟤"], all: true), ]); // Contains NO emojis at all $request->validate([ 'string_to_validate' => new DoesntContainEmojis(), ]); }
Tests
vendor/bin/phpunit
License
- MIT, see LICENSE
Version
- Version 0.3
Contact
repat
- Homepage: https://repat.de
- e-mail: repat@repat.de
- Twitter: @repat123