1. Go to this page and download the library: Download kreyu/nip-validator-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kreyu / nip-validator-bundle example snippets
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints as Assert;
class Company
{
/**
* @Assert\Nip()
*/
private $nip;
}
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints as Assert;
class Company
{
#[Assert\Nip]
private $nip;
}
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints\Nip;
use Symfony\Component\Validator\Mapping\ClassMetadata;
class Company
{
private $nip;
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('nip', new Nip());
}
}
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints as Assert;
class Company
{
/**
* @Assert\Nip(
* allowDashes=true,
*
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints as Assert;
class Company
{
/**
* @Assert\Nip(
* allowPrefix=true,
*
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints as Assert;
class Company
{
/**
* @Assert\Nip(
* patternMessage="This is not a valid NIP number."
* )
*/
private $nip;
}
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints as Assert;
class Company
{
/**
* @Assert\Nip(
* pattern="/^(\d{2}.\d{3}.\d{3}.\d{2})$/"
* )
*/
private $nip;
}
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints as Assert;
class Company
{
/**
* @Assert\Nip(
* checksum=false
* )
*/
private $nip;
}
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints as Assert;
class Company
{
/**
* @Assert\Nip(
* checksumMessage="This is not a valid NIP number."
* )
*/
private $nip;
}
namespace App\Entity;
use Kreyu\Bundle\NipValidatorBundle\Validator\Constraints as Assert;
class Company
{
/**
* @Assert\Nip(
* normalizer="trim"
* )
*/
private $nip;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.