PHPackages                             malahierba-lab/chile-rut - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. malahierba-lab/chile-rut

AbandonedArchivedLibrary[Validation &amp; Sanitization](/categories/validation)

malahierba-lab/chile-rut
========================

Librería Laravel para el manejo y validación de RUT chileno

5.1.4(6y ago)3258.0k↓43.6%15[3 PRs](https://github.com/malahierba-lab/chile-rut/pulls)MITPHPPHP &gt;=5.5.18

Since Aug 12Pushed 4y ago6 watchersCompare

[ Source](https://github.com/malahierba-lab/chile-rut)[ Packagist](https://packagist.org/packages/malahierba-lab/chile-rut)[ RSS](/packages/malahierba-lab-chile-rut/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (9)Used By (0)

Chile Rut
=========

[](#chile-rut)

Introducción
------------

[](#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

[](#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
-----------

[](#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
-----------

[](#utilización)

### Validar un rut

[](#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

[](#validar-un-rut-con-laravel)

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

```
use Malahierba\ChileRut\ChileRut;
use Malahierba\ChileRut\Rules\ValidChileanRut;

$request->validate([
    'rut' => ['required', 'string', new ValidChileanRut(new ChileRut)],
]);

```

> Ref: [Laravel: Custom Validation Rules](https://laravel.com/docs/validation#custom-validation-rules)

### Calcular dígito verificador

[](#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
--------------------------

[](#formatos-de-rut-soportados)

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

- x.xxx.xxx-x (con separador de miles y con guión)
- xxxxxxx-x (sin separador de miles y con guión)
- xxxxxxx (sin separador de miles y sin guión)

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

Licencia
--------

[](#licencia)

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

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 89.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~219 days

Recently: every ~384 days

Total

8

Last Release

2394d ago

Major Versions

4.2.x-dev → 5.1.x-dev2015-08-12

PHP version history (2 changes)5.1.0PHP &gt;=5.5.18

4.2.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9cd1a6bfe1ce32384fbfd071bf0af9fa3c7456554839aaffc02a25cd81e8a40e?d=identicon)[malahierba](/maintainers/malahierba)

---

Top Contributors

[![cristiansantana](https://avatars.githubusercontent.com/u/7772588?v=4)](https://github.com/cristiansantana "cristiansantana (34 commits)")[![franciscollanquipichun](https://avatars.githubusercontent.com/u/1309287?v=4)](https://github.com/franciscollanquipichun "franciscollanquipichun (3 commits)")[![jwcastillo](https://avatars.githubusercontent.com/u/443948?v=4)](https://github.com/jwcastillo "jwcastillo (1 commits)")

---

Tags

laravelrutchile

### Embed Badge

![Health badge](/badges/malahierba-lab-chile-rut/health.svg)

```
[![Health](https://phpackages.com/badges/malahierba-lab-chile-rut/health.svg)](https://phpackages.com/packages/malahierba-lab-chile-rut)
```

###  Alternatives

[freshwork/chilean-bundle

A PHP composer package with Chilean validations, common variables, etc. (RUT, IVA, ETC). Ready for Laravel 5. Grande chile ctm :)

97195.6k3](/packages/freshwork-chilean-bundle)[carsdotcom/laravel-json-schema

Json Schema validation for Laravel projects

1036.7k3](/packages/carsdotcom-laravel-json-schema)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
