Valium Portugal: Check identifier numbers of people from Portugal

Recommend this page to a friend!
  Info   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2021-04-14 (5 months ago) RSS 2.0 feedNot enough user ratingsTotal: 17 All time: 10,382 This week: 259Up
Version License PHP version Categories
valium-pt 1.1.0GNU General Publi...5PHP 5, Validation
Description Author
This package is specific mainly for applications used in Portugal Portugal .

This class package can check identifier numbers of people from Portugal.

It provides several classes that can validate strings with personal numbers that belong to Portugal citizens.

Currently it can validate numbers like: bilhete de identidade (BI), inter-bank account numbers (IBAN), número de identificação fiscal (NIF) and número de identificação da segurança social (NISS).

Picture of Carlos Artur Curvelo da Matos
  Performance   Level  
Name: Carlos Artur Curvelo da ... is available for providing paid consulting. Contact Carlos Artur Curvelo da ... .
Classes: 17 packages by
Country: Portugal Portugal
Age: 43
All time rank: 323441 in Portugal Portugal
Week rank: 201 Up3 in Portugal Portugal Up
Innovation award
Innovation award
Nominee: 11x

Winner: 2x

Details

Valium Portugal

Valium is an initiative that envisions to offer validation classes in PHP for checking public and official numbers and codes for different countries. This particular library focuses in the Portuguese market. This package already manages to validade the following numbers:

  • NIF/NIPC
  • NISS
  • IBAN
  • BI

Usage

Each type of number has its own class, and can be used by instantiating the respective class and using the method check() with the array of numbers/codes to be validated. The method returns an array with the codes as keys and a boolean check as value. For the NIF, the method also admits a second parameter (false as default). If TRUE, the second parameter not only validates the NIF number, but also returns the description of the type of tax payer, instead of a boolean result.

use Valium\PT\Nif;
use Valium\PT\Niss;
use Valium\PT\Iban;
use Valium\PT\Bi;

require __DIR__ . '/vendor/autoload.php';

$nif = new Nif();
// Returns a bool for each number in the array
$q = $nif->check([720014360, '291653170', 980547490, 281234500, 510837620]);
// Returns the type of tax payer for each valid number
$r = $nif->check([292679411, '720014360', 980547490, 281234500, 510837620], true);

var_dump($q);
var_dump($r);

$niss = new Niss();
// Returns a bool for each number in the array
$s = $niss->check([12060903799, 12073833086, 12060904475]);

var_dump($s);

$iban = new Iban();
// Returns a bool for each account in the array
$t = $iban->check(['PT50003300004549519501405', 'PT50001200004549519501405']);

var_dump($t);

$bi = new Bi();
// As an input, an array of the BI numbers together with the control digit (the first number before the two letters, XX, XY, i.e)
$x = $bi->check(['108015750', '34521320']);

var_dump($x);
  Files folder image Files  
File Role Description
Files folder imagesrc (4 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file Bi.php Class Class source
  Plain text file Iban.php Class Class source
  Plain text file Nif.php Class Class source
  Plain text file Niss.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:17
This week:0
All time:10,382
This week:259Up
User Comments (1)
Thats a very good work Em PT: excelente trabalho, está impec...
4 months ago (José Filipe Lopes Santos)
70%StarStarStarStar
 
For more information send a message to info at phpclasses dot org.