Skip to content

Commit f44caa8

Browse files
author
Grzegorz Koziński
committed
initial commit
0 parents  commit f44caa8

File tree

22 files changed

+3964
-0
lines changed

22 files changed

+3964
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
composer.phar
2+
vendor/
3+
bin/
4+
5+
6+

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: php
2+
php:
3+
- '5.5'
4+
- '5.6'
5+
- '7.0'
6+
install:
7+
- composer install

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2016 Grzegorz Koziński
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
Symfony2 bundle with Polish validators
2+
==================================
3+
4+
[![License](https://img.shields.io/packagist/l/kiczort/polish-validator-bundle.svg)](https://packagist.org/packages/kiczort/polish-validator-bundle)
5+
[![Version](https://img.shields.io/packagist/v/kiczort/polish-validator-bundle.svg)](https://packagist.org/packages/kiczort/polish-validator-bundle)
6+
[![Build status](https://travis-ci.org/kiczort/polish-validator-bundle.svg)](http://travis-ci.org/kiczort/polish-validator-bundle)
7+
[![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/kiczort/polish-validator-bundle.svg)](https://scrutinizer-ci.com/g/kiczort/polish-validator-bundle/)
8+
9+
This is Symfony2 bundle with validators for Polish identification numbers like: PESEL, NIP, REGON.
10+
11+
12+
# Installation
13+
14+
The recommended way to install this library is
15+
[Composer](http://getcomposer.org).
16+
17+
```bash
18+
# Install Composer
19+
curl -sS https://getcomposer.org/installer | php
20+
```
21+
22+
Next, run the Composer command to install the latest stable version:
23+
24+
```bash
25+
php composer.phar require kiczort/polish-validator-bundle
26+
```
27+
28+
Add bundle to AppKernel.php
29+
30+
```php
31+
public function registerBundles()
32+
{
33+
$bundles = array(
34+
...
35+
new Kiczort\PolishValidatorBundle\KiczortPolishValidatorBundle(),
36+
...
37+
);
38+
39+
return $bundles;
40+
}
41+
```
42+
43+
# Documentation
44+
45+
## Example of use PeselValidator:
46+
47+
There are PESEL numbers with errors in real word, so in case of this validator checksum checking is only for strict mode.
48+
In case of none strict mode it checks length, used chars and correctness of date of birth.
49+
50+
```php
51+
...
52+
// src/AppBundle/Entity/Person.php
53+
namespace AppBundle\Entity;
54+
55+
use KiczortPolishValidatorBundle\Validator\Constraints as KiczortAssert;
56+
57+
class Person
58+
{
59+
/**
60+
* @KiczortAssert\Pesel(
61+
* message = "The '{{ value }}' is not a valid PESEL number.",
62+
* strict = true
63+
* )
64+
*/
65+
protected $pesel;
66+
}
67+
```
68+
69+
## Example of use NipValidator:
70+
71+
```php
72+
...
73+
// src/AppBundle/Entity/Person.php
74+
namespace AppBundle\Entity;
75+
76+
use KiczortPolishValidatorBundle\Validator\Constraints as KiczortAssert;
77+
78+
class Person
79+
{
80+
/**
81+
* @KiczortAssert\Nip
82+
*/
83+
protected $nip;
84+
}
85+
```
86+
87+
## Example of use RegonValidator:
88+
89+
```php
90+
...
91+
// src/AppBundle/Entity/Company.php
92+
namespace AppBundle\Entity;
93+
94+
use KiczortPolishValidatorBundle\Validator\Constraints as KiczortAssert;
95+
96+
class Company
97+
{
98+
/**
99+
* @KiczortAssert\Regon
100+
*/
101+
protected $regon;
102+
}
103+
```
104+
105+
# Bug tracking
106+
107+
[GitHub issues](https://github.com/kiczort/polish-validator-bundle/issues).
108+
If you have found bug, please create an issue.
109+
110+
111+
# MIT License
112+
113+
License can be found [here](https://github.com/kiczort/polish-validator-bundle/blob/master/LICENSE).
114+

composer.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "kiczort/polish-validator-bundle",
3+
"description": "Symfony2 bundle with validators for Polish identification numbers: PESEL, NIP, REGON.",
4+
"keywords": ["polish validator", "pl validator", "pesel", "nip", "regon", "symfony bundle", "validator", "symfony validator"],
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Grzegorz Koziński",
9+
"email": "gkozinski@gmail.com"
10+
}
11+
],
12+
"minimum-stability": "dev",
13+
"require": {
14+
"php": ">=5.3.1",
15+
"kiczort/polish-validator": "^1.0",
16+
"symfony/framework-bundle" : "~2.1",
17+
"symfony/validator": "^2.1"
18+
},
19+
"require-dev": {
20+
"phpunit/phpunit": "4.8"
21+
},
22+
"autoload": {
23+
"psr-0": {
24+
"": "src/"
25+
}
26+
},
27+
"config": {
28+
"bin-dir": "bin"
29+
}
30+
}

0 commit comments

Comments
 (0)