PHPackages                             devlabs/chileanrut - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. devlabs/chileanrut

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

devlabs/chileanrut
==================

A Chilean Rut script to handle ruts

v1.5.0(3y ago)0137MITPHP

Since Feb 13Pushed 3y ago2 watchersCompare

[ Source](https://github.com/devlabscl/chilean-rut-php)[ Packagist](https://packagist.org/packages/devlabs/chileanrut)[ Docs](https://github.com/devlabs/chilean-rut-php)[ RSS](/packages/devlabs-chileanrut/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

ChileanRut
==========

[](#chileanrut)

[![Latest Version on Packagist](https://camo.githubusercontent.com/64c4650e6b854d61f2687d691b5a2d3ef6969e04283f08584d64bc1a583503fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465766c6162732f6368696c65616e7275742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devlabs/chileanrut)[![Total Downloads](https://camo.githubusercontent.com/a7bd5d55ec00ce51acd4ab9c3d581b6d8a0fbc78e8c73295243740bdbb5c35f6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6465766c6162732f6368696c65616e7275742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devlabs/chileanrut)

A Chilean Rut script to handle ruts. Take a look at [contributing.md](contributing.md) to see a to do list.

Installation
------------

[](#installation)

Via Composer

```
$ composer require devlabs/chileanrut
```

Usage
-----

[](#usage)

### Format Function

[](#format-function)

Format the rut according to the assigned parameters, if withDotted is true it will always return with a hyphen, return string value

ParamsTypeDescription$rutstringrut with any of these formats 11.111.111-1, 11111111-1, 111111111$withDottedboolreturn rut with dots format, default true$withHyphenboolreturn rut with hyphen format. default true```
Rut::format('123123123'); // return 12.312.312-3
Rut::format('123123123', false); // return 12312312-3
Rut::format('123123123', false, false); // return 123123123 (it is best to use the unformat function)
```

### Unformat Function

[](#unformat-function)

Clean the rut of spaces, dots and hyphens, return string value

ParamsTypeDescription$rutstringrut with any of these formats 11.111.111-1, 11111111-1, 111111111```
Rut::unformat('12.312.312-3'); // return 123123123
```

### Validate Function

[](#validate-function)

Check if the code is valid with the validation algorithm, return boolean value

ParamsTypeDescription$rutstringrut with any of these formats 11.111.111-1, 11111111-1, 111111111```
Rut::validate('12.312.312-3'); // return true
```

### Calculate Dv Function

[](#calculate-dv-function)

Calculates the check digit from a sequential rut number, return string value

ParamsTypeDescription$numberintonly the number of rut as integer type```
Rut::calculateDv(12312312); // return 3
```

### Get Number Function

[](#get-number-function)

Extract the numerical part of the rut, can return with points according to the parameters, return string value

ParamsTypeDescription$rutstringrut with any of these formats 11.111.111-1, 11111111-1, 111111111$withDottedboolreturn rut with dots format, default true```
Rut::getNumber('12312312-3'); // return 12312312
Rut::getNumber('12312312-3', true); // return 12.312.312
```

### Get Dv Function

[](#get-dv-function)

Extract the check digit part of the rut, return string value

ParamsTypeDescription$rutstringrut with any of these formats 11.111.111-1, 11111111-1, 111111111```
Rut::getDv('12312312-3'); // return 3
```

### Example

[](#example)

```
namespace App\Http\Controllers;

use Devlabs\ChileanRut\Rut;

class RutController extends Controller
{
    public function index()
    {
        $format = Rut::format('123123123');
        $unformat = Rut::unformat($format);
        return [
            $format,
            $unformat,
            Rut::validate($unformat),
            Rut::calculateDv(12312312),
            Rut::getNumber($format, false),
            Rut::getDv($format),
        ];
    }
}
```

Result

```
[
  "12.312.312-3",
  "123123123",
  true,
  "3",
  "12312312",
  "3"
]
```

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Alejandro Isla](https://github.com/devlabscl)
- [All Contributors](../../contributors)

License
-------

[](#license)

license. Please see the [license file](license.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1188d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb10db2c683da7b54ef4dd41d33a46e34e3b3ab306c2d97daad9adb2b4380959?d=identicon)[Willywes](/maintainers/Willywes)

---

Top Contributors

[![Willywes](https://avatars.githubusercontent.com/u/4291325?v=4)](https://github.com/Willywes "Willywes (1 commits)")

---

Tags

laravelrutchileanrutRut ChilenoValidar RutFormatear RutCalcular Rut

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/devlabs-chileanrut/health.svg)

```
[![Health](https://phpackages.com/badges/devlabs-chileanrut/health.svg)](https://phpackages.com/packages/devlabs-chileanrut)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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