PHP Classes
elePHPant
Icontem

PHP Valida RUT: Validate RUT Chilean numbers

Recommend this page to a friend!
  Info   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2014-05-02 (2 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 102 All time: 8,359 This week: 893Up
Version License PHP version Categories
valida-rut 1.2BSD License5.3.0PHP 5, Validation
Description Author
This package is specific mainly for applications used in Chile Chile .

This class can validate RUT (Rol ┌nico Tributario) Chilean numbers.

It can take a Chile RUT number and validate it by checking the validation digit. It also determines if it is a RUT or a RUN (Rol ┌nico Nacional).

The class can also generate JavaScript code to validate a RUT number on the browser.

Picture of Camilo Sperberg
  Performance   Level  
Name: Camilo Sperberg <contact>
Classes: 8 packages by
Country: The Netherlands The Netherlands
Age: 34
All time rank: 77023 in The Netherlands The Netherlands
Week rank: 212 Up7 in The Netherlands The Netherlands Up

Details
[![Latest Stable Version](https://poser.pugx.org/unreal4u/rutverifier/v/stable.png)](https://packagist.org/packages/unreal4u/rutverifier)
[![Build Status](https://travis-ci.org/unreal4u/rutverifier.png?branch=master)](https://travis-ci.org/unreal4u/rutverifier)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/unreal4u/rutverifier/badges/quality-score.png?s=41b9a0c72279222d0e5172565ea4f9944b6c0e5e)](https://scrutinizer-ci.com/g/unreal4u/rutverifier/)
[![Code Coverage](https://scrutinizer-ci.com/g/unreal4u/rutverifier/badges/coverage.png?s=bf9bcc36803a605d4f7d2e642c1b2648af94cb2c)](https://scrutinizer-ci.com/g/unreal4u/rutverifier/)
[![License](https://poser.pugx.org/unreal4u/rutverifier/license.png)](https://packagist.org/packages/unreal4u/rutverifier)

rutverifier.php
======

Credits
--------

This class is made by unreal4u (Camilo Sperberg) [Homepage](http://unreal4u.com/)

About this class
--------

* Can be used to verify chilean RUT (Rol ├║nico tributario) or RUN (Rol ├║nico nacional). (<a href="http://www.registrocivil.cl/PortalOI/html/faq/Cod_Area_4/Cod_Tema_30/pregunta_155.html">Difference</a> [spanish])
* Will give you some information, such as the RUT/RUN being consulted is an enterprise (RUT) or a natural person (RUN).
* Allows you to make use of a blacklist (Useful for known frauders).
* Will also format the RUT/RUN into the correct format.
* Can deliver also a pure (more basic) Javascript coded version to verify the validity of a RUT/RUN

Detailed description
---------

This package will do all kinds of things you can do with a RUT or RUN, such as:

* Verifying that it is valid.
* Finding out whether it is a RUT or a RUN.
* Format it to the correct format to use / store / work with

Basic usage
----------

<pre>include('src/unreal4u/rutverifier.php');
$rutVerifier = new unreal4u\rutverifier();
$result = $rutVerifier->isValidRUT('30.686.957-4');
</pre>
* Congratulations! Result does now contain true or false depending on the RUT/RUN being valid or not.
* **Please see examples for more options and advanced usage**

Composer
----------

This class has support for Composer install. Just add the following section to your composer.json with:

<pre>
{
    "require": {
        "unreal4u/rutverifier": "@stable"
    }
}
</pre>

Now you can instantiate a new rutverifier class by executing:

<pre>
require('vendor/autoload.php');

$rutverifier = new unreal4u\rutverifier();
</pre>

Don't forget to do a <code>composer.phar install</code> or download and include
<code>http://packagist.org/unreal4u/rutverifier-js</code> manually

Pending
---------
* Class will throw exceptions instead of adding silently to an internal error array
* Native i18n support

Version History
----------

* 1.0 :
    * Initial version
* 1.1:
    * PHPUnit testing
    * Documentation improved (Created this README actually)
    * More examples
    * Solved some bugs
* 1.2:
    * Compatibility with composer
    * Better documentation
* 1.2.1:
    * Real compatibility with composer
* 1.2.2:
    * Minor bugs in documentation
* 1.2.4:
    * Documentation
    * Better PHPUnit tests
    * Fixed a bug related to cache and blacklisting
    * Included PHPDocumentor to src code
* 1.2.6:
    * Excluded PHPDocumentation
* 1.2.8:
    * Travis-CI support
    * Very small optimization on Javascript function
    * Began deprecating some old naming conventions
* 2.0.0:
    * Removed c_javascript function
    * Standarized data type on return for all functions, no more mixed types
    * Updated PHPUnit dependency to latest stable version
    * Will now test PHP 5.3 in Travis-CI as well
    * Class will now sprintf into the error array in preparation for later i18n implementation
* 2.1.0:
    * Now checking JavaScript code with grunt
* 2.2.0:
    * This class has now a dependency on unreal4u/rutverifier-js, downloadable on packagist
    * Cleaned up javascript code that had nothing to do with PHP

Contact the author
-------

* Twitter: [@unreal4u](http://twitter.com/unreal4u)
* Website: [http://unreal4u.com/](http://unreal4u.com/)
* Github:  [http://www.github.com/unreal4u](http://www.github.com/unreal4u)
  Files folder image Files  
File Role Description
Files folder imageexamples (1 file)
Files folder imagesrc (1 directory)
Files folder imagetests (2 files)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files  /  examples  
File Role Description
  Accessible without login Plain text file simple-verifier.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageunreal4u (1 file)

  Files folder image Files  /  src  /  unreal4u  
File Role Description
  Accessible without login Plain text file rutverifier.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Accessible without login Plain text file bootstrap.php Test Unit test script
  Accessible without login Plain text file rutverifierTest.php Test Unit test script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:102
This week:0
All time:8,359
This week:893Up