Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexeevdv/yii2-kz-personalid
Yii2 extension to deal with Kazakhstan individual identification number
https://github.com/alexeevdv/yii2-kz-personalid
kz personalidentity validator yii2 yii2-extension
Last synced: about 1 month ago
JSON representation
Yii2 extension to deal with Kazakhstan individual identification number
- Host: GitHub
- URL: https://github.com/alexeevdv/yii2-kz-personalid
- Owner: alexeevdv
- License: mit
- Created: 2017-06-17T11:58:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-21T06:16:25.000Z (almost 7 years ago)
- Last Synced: 2024-11-13T14:55:10.481Z (about 2 months ago)
- Topics: kz, personalidentity, validator, yii2, yii2-extension
- Language: PHP
- Homepage:
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
yii2-kz-personalid
===========[![Build Status](https://travis-ci.org/alexeevdv/yii2-kz-personalid.svg?branch=master)](https://travis-ci.org/alexeevdv/yii2-kz-personalid)
[![codecov](https://codecov.io/gh/alexeevdv/yii2-kz-personalid/branch/master/graph/badge.svg)](https://codecov.io/gh/alexeevdv/yii2-kz-personalid)
![PHP 5.6](https://img.shields.io/badge/PHP-5.6-green.svg)
![PHP 7.0](https://img.shields.io/badge/PHP-7.0-green.svg)
![PHP 7.1](https://img.shields.io/badge/PHP-7.1-green.svg)
![PHP 7.2](https://img.shields.io/badge/PHP-7.2-green.svg)Yii2 extension to deal with [Kazakhstan personal identification number](https://ru.wikipedia.org/wiki/%D0%98%D0%BD%D0%B4%D0%B8%D0%B2%D0%B8%D0%B4%D1%83%D0%B0%D0%BB%D1%8C%D0%BD%D1%8B%D0%B9_%D0%B8%D0%B4%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%BE%D0%BD%D0%BD%D1%8B%D0%B9_%D0%BD%D0%BE%D0%BC%D0%B5%D1%80)
It contains:
- Both server-side and client-side validators
- Helper to fetch data from identification number## Installation
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
$ php composer.phar require alexeevdv/yii2-kz-personalid "~1.0"
```or add
```
"alexeevdv/yii2-kz-personalid": "~1.0"
```to the ```require``` section of your `composer.json` file.
## Usage
### Validation
#### As standalone validator
```php
use alexeevdv\kz\PersonalidValidator;//...
$validator = new PersonalidValidator;
$result = $validator->validateValue('123456789012');
//...
```### In model
```php
use alexeevdv\kz\PersonalidValidator;public function rules()
{
//...
['personalid', PersonalidValidator::class, 'message' => 'Wrong personalid value!'],
//...
}
```### Helper
```php
use alexeevdv\kz\PersonalidHelper;$personalid = '850407301166';
/** @var \DateTime $birtdate = 1985-04-07 */
$birtdate = PersonalidHelper::getBirthDate($personalid);/** @var int $sex = PersonalidHelper::SEX_MALE */
$sex = PersonalidHelper::getSex($personalid);/** @var string $serialNumber = 0116 */
$serialNumber = PersonalidHelper::getSerialNumber($personalid);
```