PHPackages                             square-bit/laravel-pt-rules - 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. square-bit/laravel-pt-rules

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

square-bit/laravel-pt-rules
===========================

Validation rules relevant to Portugal

v1.4.2(10mo ago)43.2k↓38.9%MITPHP

Since Nov 5Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/square-bit/laravel-pt-rules)[ Packagist](https://packagist.org/packages/square-bit/laravel-pt-rules)[ Docs](https://github.com/square-bit/laravel-pt-rules)[ RSS](/packages/square-bit-laravel-pt-rules/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (0)

Set of validation rules relevant for Portugal
=============================================

[](#set-of-validation-rules-relevant-for-portugal)

[![Latest Stable Version](https://camo.githubusercontent.com/60700798de202b62d578c83f6d1f3cd505a581385591e01170d4075efc95817d/68747470733a2f2f706f7365722e707567782e6f72672f7371756172652d6269742f6c61726176656c2d70742d72756c65732f76)](//packagist.org/packages/square-bit/laravel-pt-rules)[![License](https://camo.githubusercontent.com/0e51d3cba53f9dac5e3a9949b996306bfa32072004af232d7803e879c3409bcf/68747470733a2f2f706f7365722e707567782e6f72672f7371756172652d6269742f6c61726176656c2d70742d72756c65732f6c6963656e7365)](//packagist.org/packages/square-bit/laravel-pt-rules)[![Total Downloads](https://camo.githubusercontent.com/849d683211dc0321743e84399b1e01e09d1d64b16b0d6948fa10c70e734f0334/68747470733a2f2f706f7365722e707567782e6f72672f7371756172652d6269742f6c61726176656c2d70742d72756c65732f646f776e6c6f616473)](//packagist.org/packages/square-bit/laravel-pt-rules)

This package provides a set of Rules for Laravel 8 that are mainly useful to validate Portuguese ... stuff .... such as NIFs and CCs.

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

[](#installation)

Via Composer

```
$ composer require square-bit/laravel-pt-rules
```

Usage
-----

[](#usage)

Just like any other validation rule, simply add the desired class to the list of rules. Example:

```
return Validator::make($data, [
    [...]
    'nif' => ['required', new NIF()],
    [...]
]);

```

Available rules
---------------

[](#available-rules)

ClassDescriptionNIFChecks if the input is a valid Portuguese Fiscal ID number. Accepts both with and without the country preffix, ex: '123456789' or 'PT123456789'CompanyNIFChecks if the input is a valid Portuguese Fiscal ID number for a company (i.e. it starts with 5 or 9). Accepts both with and without the country preffix, ex: '523456789' or 'PT523456789'BIChecks if the input is a valid Portuguese Identification Card number. (requires the entire number, including the last digit)CCChecks if the input is a valid Portuguese Citizen Card number. (requires the full number, ex: "12233456 7 ZZ0")Change log
----------

[](#change-log)

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

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Squarebit](https://github.com/square-bit)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance58

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.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 ~341 days

Recently: every ~395 days

Total

6

Last Release

312d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/63dd954cd38674cf0319666e08400850a3ef880b42e630d1b6de7b70c4caa332?d=identicon)[saidatom](/maintainers/saidatom)

![](https://www.gravatar.com/avatar/01faacc649020a16c1cceb7ec2dd2cf579c5de812ee9a88aad11be04e41c54bf?d=identicon)[Squarebit](/maintainers/Squarebit)

![](https://www.gravatar.com/avatar/2d983f39b1b70e94a81617ec324d9f613cb618aa0ccce1fbfed6e182f9425179?d=identicon)[tiagof](/maintainers/tiagof)

---

Top Contributors

[![tiagof](https://avatars.githubusercontent.com/u/1729910?v=4)](https://github.com/tiagof "tiagof (14 commits)")[![saidatom](https://avatars.githubusercontent.com/u/2377368?v=4)](https://github.com/saidatom "saidatom (2 commits)")

---

Tags

laravel-packageportugalrules

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/square-bit-laravel-pt-rules/health.svg)

```
[![Health](https://phpackages.com/badges/square-bit-laravel-pt-rules/health.svg)](https://phpackages.com/packages/square-bit-laravel-pt-rules)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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