PHP Myanmar NRC
Fund package maintenance!
laravel-myanmar-tools
v1.0.1
2023-02-18 16:51 UTC
Requires
- php: ^8.1
- spatie/macroable: ^2.0
Requires (Dev)
- laravel/pint: ^1.2
- pestphp/pest: ^1.20
This package is auto-updated.
Last update: 2024-12-09 15:28:43 UTC
README
Nrc
PHP Myanmar Nrc for Laravel Myanmar Tools
Installation
composer require laravel-myanmar-tools/nrc
Usage
Check Nrc
use LaravelMyanmarTools\Nrc\Nrc; $nrc = new Nrc; $nrc->isNrc('12/OUKAMA(N)123456'); // return true $nrc->isNrc('12/OuKaMa(Naing)123456'); // return true $nrc->isNrc('၁၂/ဥကမ(နိုင်)၁၂၃၄၅၆'); // return true
Normalize Nrc
use LaravelMyanmarTools\Nrc\Nrc; $nrc = new Nrc; $nrc->normalizeNrc('12/OUKAMA(N)123456'); // return "12/OUKAMA(N)123456" $nrc->normalizeNrc('12/OUKAMA(N)123456', 'mm'); // return "၁၂/ဥကမ(နိုင်)၁၂၃၄၅၆" $nrc->normalizeNrc('12/OuKaMa(Naing)123456'); // return "12/OUKAMA(N)123456" $nrc->normalizeNrc('12/OuKaMa(Naing)123456', 'mm'); // return "၁၂/ဥကမ(နိုင်)၁၂၃၄၅၆" $nrc->normalizeNrc('၁၂/ဥကမ(နိုင်)၁၂၃၄၅၆'); // return "12/OUKAMA(N)123456" $nrc->normalizeNrc('၁၂/ဥကမ(နိုင်)၁၂၃၄၅၆', 'mm'); // return "၁၂/ဥကမ(နိုင်)၁၂၃၄၅၆"
Customize
use LaravelMyanmarTools\Nrc\Nrc; use Illuminate\Support\Str; $nrc = new Nrc; $nrc::macro('isYangon', function(string $nrc) { return Str::before($nrc, '/') == '12'; }); $nrc->isYangon('12/OuKaMa(Naing)123456'); // return true
Testing
composer test