Skip to content

juanstiza/Rut

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Composer

composer require juanstiza/rut master-dev

or copy in your composer.json file

{
    "require": {
        "juanstiza/rut": "master-dev"
    }
}

Usage

use JuanStiza\Rut\Rut;

$rut = new Rut(1234567,8);

print_r( $rut->dv );
/* '8' */

print_r( $rut->rut );
/* '1234567' */

print_r( $rut->isValid );
/* false */

$otherRut = new Rut("11.111.111-1");
print_r( $otherRut->isValid );
/* true */

$yetAnotherRut = new Rut('111111111');
print_r( $yetAnotherRut->isValid );
/* true */

Find the verifying digit for a rut
print_r(Rut::findDV(1234));
/* 3 */

Return formated string:
$rut = new Rut('24232771-3');
print_r($rut->format());
/* "24.232.771-3" */
print_r($rut->format('','-'));
/* "24232771-3" */

About

Chilean Rut validator

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages