Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomaszkr/pesel
All for PESEL
https://github.com/tomaszkr/pesel
number-pesel oop pesel php php71 validation
Last synced: 4 days ago
JSON representation
All for PESEL
- Host: GitHub
- URL: https://github.com/tomaszkr/pesel
- Owner: TomaszKr
- License: mit
- Created: 2017-10-08T19:06:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-18T22:11:20.000Z (almost 2 years ago)
- Last Synced: 2025-01-03T06:52:18.300Z (about 1 month ago)
- Topics: number-pesel, oop, pesel, php, php71, validation
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pesel
Object Pesel
PESEL mean Personal Identificator for Poland[![Build Status](https://travis-ci.org/TomaszKr/Pesel.svg?branch=master)](https://travis-ci.org/TomaszKr/Pesel)
## Getting Started
Used this object for every time when your project has number PESEL and you must validation it.
### Required
```
PHP >= 7.1
```### Installing
Go to your project directory where the ``composer.json`` file is located and type:
```
composer install tomasz-kr/pesel
```## Running the tests
```
phpunit --configuration phpunit.xml
```## Overview
Firstly, create object Pesel and add in constructor number Pesel:
```
$pesel = new PESEL("NUMBER");
```Now, you can take information about:
* Correct format
```
$pesel->isCorrectLenght(); //boolean
```* Correct only number
```
$pesel->isCorrectNumber(); //boolean
```* Correct for number controls
```
$pesel->valid(); //boolean
```* Correct for exist in this day
```
$pesel->isCorrectDateNow();
```* Correct for all condition
```
$pesel->isCorrect(); //boolean
```* Birthday
```
$pesel->getBirthday()->format("Y-m-d");
```* Gender
```
$pesel->setTextForMan("Man");
$pesel->setTextForWoman("Woman");
$pesel->whatGender(); //return man or woman
```* Correct year between 2 years (min and max)
```
$pesel->isCorrectYear(); //boolean
```
Default:
> Min has 1st January 1800> Max has this days
* Set max year
```
$pesel->setMaxYear(\DateTime $dateTime);
```* Set min year
```
$pesel->setMinYear(\DateTime $dateTime);
```## Author
[Tomasz Król](http://tomaszkrol.eu)## License
This project is licensed under the MIT Licence - see the [LICENSE](LICENSE.md) file for details