PHP code example of sinemacula / data-normalizer-php
1. Go to this page and download the library: Download sinemacula/data-normalizer-php 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/ */
sinemacula / data-normalizer-php example snippets
use SineMacula\Foundation\Normalizers\Normalizer;
Normalizer::name('SMITH, john'); // 'John Smith'
Normalizer::email(' [email protected] '); // '[email protected]'
Normalizer::phone('(650) 253-0000'); // '+16502530000'
Normalizer::country('Untied States'); // 'US' (fuzzy match)
Normalizer::postalCode('sw1a1aa', 'GB'); // 'SW1A 1AA'
Normalizer::clean(' not a phone '); // 'not a phone'
Normalizer::phone('not a phone'); // null
use SineMacula\Foundation\Normalizers\Contracts\NormalizerInterface;
use SineMacula\Foundation\Normalizers\Normalizer;
class Iban implements NormalizerInterface
{
public static function normalize(mixed $value, mixed $context = null): ?string
{
return is_string($value) ? strtoupper(str_replace(' ', '', $value)) : null;
}
}
Normalizer::register('iban', Iban::class);
$iban = Normalizer::iban('de89 3704 0044 0532 0130 00'); // DE89370400440532013000
use SineMacula\Foundation\Normalizers\Normalizer as BaseNormalizer;
/**
* @method static string|null iban(string $value)
*/
class Normalizer extends BaseNormalizer {}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.