Download the PHP package malahierba-lab/chile-rut without Composer

On this page you can find all versions of the php package malahierba-lab/chile-rut. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package chile-rut

Chile Rut

Introducción

Esta librería permite trabajar con el número de identificación que se utiliza en chile para personas, tanto naturales como jurídicas, pudiendo realizar las tareas de validación y formato.

Se ha desarrollado pensando en Laravel.

Aclaración sobre el alcance

Sólo valida el número de identificación respecto a cumplir con el algoritmo que se utiliza, no comprueba la existencia real de dicho rut.

Instalación

Para instalar esta librería basta con que la agregues a la sección require del composer.json de tu proyecto y luego ejecutes composer update

Para Laravel 5.x o superior

"malahierba-lab/chile-rut": "5.1.*"

Para Laravel 4.2

"malahierba-lab/chile-rut": "4.2.*"

Importante: Si estás usando actualmente la versión "dev-master" debes cambiarlo por una de las versiones indicadas de acuerdo a la versión de Laravel que estés utilizando.

Luego carga el Service Provider dentro del arreglo 'providers' del archivo app/config/app.php

Para Laravel 5.x

Malahierba\ChileRut\ChileRutServiceProvider::class

Para Laravel 4.2

'Malahierba\ChileRut\ChileRutServiceProvider'

Opcionalmente (pero altamente recomendado) puedes crear un alias dentro del archivo app/config/app.php en el arreglo 'aliases' para poder invocar las funcionalidades directamente.

Para Laravel 5.x

'RUT' => Malahierba\ChileRut\Facades\ChileRut::class

Para Laravel 4.2

'RUT' => 'Malahierba\ChileRut\Facades\ChileRut'

Si no deseas usar un Facade, sino la clase misma, no olvides incorporarlo en la clase donde desees usarlo:

use Malahierba\ChileRut\ChileRut;

Utilización

Validar un rut

Para validar un rut chileno simplemente usas: RUT::check($rut_a_validar). Ej:

if (RUT::check('12.345.678-9'))
  echo 'es verdadero';
else
  echo 'es falso';

Recuerda que en caso de no usar el Facade, debes usar la clase misma:

$chilerut = new ChileRut; //o \Malahierba\ChileRut\ChileRut en caso de que no hayas importado la clase

if ($chilerut::check('12.345.678-9'))
    echo 'es verdadero';
  else
    echo 'es falso';

Validar un RUT con Laravel

Ejemplo de validación de petición usando regla de validación personalizada:

Ref: Laravel: Custom Validation Rules

Calcular dígito verificador

En caso de que tengamos un rut sin digito verificador y necesitemos calcularlo, se usa: RUT::digitoVerificador($rut). Ej:

$digitoVerificador = RUT::digitoVerificador($rut);

OBS: considerando el caso en que el dígito verificador sea 'K', se determinó que esta función siempre devuelve un string para ser consistentes con su uso y poder realizar comparaciones con mayor control.

Formatos de RUT soportados

Si tenemos un rut de la forma: x.xxx.xxx-x son soportados los siguientes formatos para trabajar con él:

OBS: Cualquiera sea el formato podrá comenzar con cero(s). Ej: 0x.xxx.xxx-x está soportado.

Licencia

Esta librería se distribuye con licencia MIT, favor leer el archivo LICENSE para mayor referencia.


All versions of chile-rut with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.18
laravel/framework Version >=5.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package malahierba-lab/chile-rut contains the following files

Loading the files please wait ....