PHP code example of phillarmonic / pixicato-bundle

1. Go to this page and download the library: Download phillarmonic/pixicato-bundle 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/ */

    

phillarmonic / pixicato-bundle example snippets


use Phillarmonic\PIXicato\PixKey;

$pixKey = new PixKey('[email protected]');
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('[email protected]'))->isValid() ? 'Valid' : 'Invalid';

use Phillarmonic\PIXicato\Validator\Constraints as PIXAssert;

class User
{
    #[PIXAssert\ValidPixKey(
        message: 'This is not a valid PIX key.',
        expectedType: 'email'
    )]
    private string $pixKey;

    // ...
}