phillarmonic / pixicato-bundle
A Symfony bundle for validating Brazilian PIX keys.
Installs: 5 175
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 2
Type:symfony-bundle
Requires
- php: ^8.1
- giggsey/libphonenumber-for-php: ^8.0
- phillarmonic/cpf-cnpj: ^1.0
- symfony/framework-bundle: ^6.0|^7.0
- symfony/validator: ^6.0|^7.0
Requires (Dev)
- phpunit/phpunit: ^10.0|^11.0
- squizlabs/php_codesniffer: *
- symfony/phpunit-bridge: ^6.0|^7.0
This package is auto-updated.
Last update: 2025-05-05 10:16:24 UTC
README
A Symfony bundle for validating Brazilian PIX keys.
Pluck the right key every time :)
Installation
composer require phillarmonic/pixicato-bundle
Usage
Validating a PIX key
use Phillarmonic\PIXicato\PixKey; $pixKey = new PixKey('example@email.com'); if ($pixKey->isValid()) { echo "Valid PIX key of type: " . $pixKey->getType()->value; } else { echo "Invalid PIX key"; } // You can do it in a one-liner too echo (new PixKey('example@example.com'))->isValid() ? 'Valid' : 'Invalid';
Using the Symfony validator
use Phillarmonic\PIXicato\Validator\Constraints as PIXAssert; class User { #[PIXAssert\ValidPixKey( message: 'This is not a valid PIX key.', expectedType: 'email' )] private string $pixKey; // ... }
Supported PIX key types
- CPF
- CNPJ
- Phone number
License
This library is released under the MIT License. See the bundled LICENSE file for details.