Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jongotlin/identitynumbervalidatorbundle
Symfony bundle to validate Swedish identity-, coordination- and organizationnumbers
https://github.com/jongotlin/identitynumbervalidatorbundle
personnummer social-security-number symfony symfony-bundle
Last synced: 15 days ago
JSON representation
Symfony bundle to validate Swedish identity-, coordination- and organizationnumbers
- Host: GitHub
- URL: https://github.com/jongotlin/identitynumbervalidatorbundle
- Owner: jongotlin
- License: mit
- Created: 2017-11-30T06:35:11.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-14T13:41:35.000Z (almost 3 years ago)
- Last Synced: 2024-10-11T13:13:03.611Z (about 1 month ago)
- Topics: personnummer, social-security-number, symfony, symfony-bundle
- Language: PHP
- Size: 14.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IdentityNumberValidatorBundle
[![Build Status](https://img.shields.io/travis/jongotlin/IdentityNumberValidatorBundle/master.svg)](https://travis-ci.org/jongotlin/IdentityNumberValidatorBundle)
This Symfony Bundle uses [github.com/byrokrat/id](https://github.com/byrokrat/id) to validate swedish identity number (personnummer), coordination number (samordningsnummer) and organization number (organisationsnummer).
## Install
Via Composer
```bash
$ composer require jongotlin/identity-number-bundle
``````php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new JGI\IdentityNumberValidatorBundle\IdentityNumberValidatorBundle(),
}
}
}
```## Usage
```php
use JGI\IdentityNumberValidatorBundle\Validator\Constraints as IdentityNumberAssert;/**
* @IdentityNumberAssert\IdentityNumber(allowCoordinationNumber=true)
*/
private $identityNumber;/**
* @IdentityNumberAssert\OrganizationNumber(allowPersonalIdNumber=true, allowCoordinationNumber=true)
*/
private $organizationNumber;
```Available options are
- `allowCoordinationNumber` When set to true coordination number (samordningsnummer) is accepted. Default is false.
- `allowPersonalIdNumber` When set to true personal identity number is accepted as organization number. Default is false.
- `strict` When set to true identity number must be exactly 12 digits and organization number 10 digits. No hyphen is accepted. If false identity number can be either 10 or 12 digits and with or without hyphen (or plus sign). Default is false.