PHPackages                             raditzfarhan/sahrule - 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. raditzfarhan/sahrule

ActiveLaravel-package[Validation &amp; Sanitization](/categories/validation)

raditzfarhan/sahrule
====================

Missing Laravel validation rules.

v1.0.1(6y ago)0114MITPHPPHP ^7.2.5

Since May 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/raditzfarhan/sahrule)[ Packagist](https://packagist.org/packages/raditzfarhan/sahrule)[ RSS](/packages/raditzfarhan-sahrule/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

SahRule
=======

[](#sahrule)

[![Latest Stable Version](https://camo.githubusercontent.com/8110259dcd3f5c35030073c0f0f7ab1df8c8b1cfbb6172f3216ef60ac311d48a/68747470733a2f2f706f7365722e707567782e6f72672f72616469747a66617268616e2f73616872756c652f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/raditzfarhan/sahrule)[![Total Downloads](https://camo.githubusercontent.com/aa4d4c0f956104e2d33331c729f9567e10c178639666349ed36a8c49d332e066/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616469747a66617268616e2f73616872756c653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/raditzfarhan/sahrule)[![License](https://camo.githubusercontent.com/21d11b411aaa5281adad5fb221704f3f97a4d9a85f62c7152502bf4f66e46f1f/68747470733a2f2f706f7365722e707567782e6f72672f72616469747a66617268616e2f73616872756c652f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/raditzfarhan/sahrule)[![StyleCI](https://camo.githubusercontent.com/3ebb9759d3748ad0fa1b6c7f477c842a04b4bdc799f75a8b68f3c6d585d07be8/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f373534383938362f736869656c643f7374796c653d737175617265)](https://github.com/raditzfarhan/sahrule)

This package provides missing Laravel validation rules.

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

[](#installation)

Via Composer

```
$ composer require raditzfarhan/sahrule
```

Usage
-----

[](#usage)

Import validation classes that you need and use it in Laravel validate function as you normally would. Example usage as below snippet:

```
use RaditzFarhan\SahRule\Rules\Base64Image;

...

// will accept pre-defined allowed image types
$validatedData = $request->validate([
    'image' => ['required', new Base64Image]
]);

// specify allowed image types
$validatedData = $request->validate([
    'image' => ['required', new Base64Image('png', 'gif')]
]);
```

> Use array instead of pipe-delimited string.

Available Rules
---------------

[](#available-rules)

All rules are under `RaditzFarhan\SahRule\Rules` namespace.

RuleDescriptionExampleBase64ImageValidate a base64 image string. Pre-defined allowed image types are **jpg**, **jpeg**, **png**, **gif**, **bmp** and **tiff**.`new Base64Image`
`new Base64Image('jpg', 'png')`Base64MaxImageSizeValidate a base64 image size. Default max size is 2 MB. Pass your own max size in byte (B).`new Base64MaxImageSize`
`new Base64MaxImageSize(500)`Validation Message
------------------

[](#validation-message)

All rules come with a default validation message that was pre-defined by the package. If you need to write your own custom message, you can overwrite in in `validation.php` file that typically can be found at `resources/lang/en` folder.

The validation key is the rule class name in snake case format. For example for `Base64Image` rule, the key is `base64_image`. Snippet as below:

```
return [
    ...
    'base64_image' => 'Your custom validation message here.',
    ...
];
```

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

[](#change-log)

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

Credits
-------

[](#credits)

- [Raditz Farhan](https://github.com/raditzfarhan)

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Every ~0 days

Total

2

Last Release

2202d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1203676?v=4)[Raditz Farhan](/maintainers/raditzfarhan)[@raditzfarhan](https://github.com/raditzfarhan)

---

Top Contributors

[![raditzfarhan](https://avatars.githubusercontent.com/u/1203676?v=4)](https://github.com/raditzfarhan "raditzfarhan (15 commits)")

---

Tags

laravelvalidationlumenrulerules

### Embed Badge

![Health badge](/badges/raditzfarhan-sahrule/health.svg)

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

###  Alternatives

[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[illuminatech/validation-composite

Allows uniting several validation rules into a single one for easy re-usage

184485.5k](/packages/illuminatech-validation-composite)[timacdonald/rule-builder

A fluent rule builder for Laravel validation rule generation.

1027.7k](/packages/timacdonald-rule-builder)[resultsystems/validation

Inspired 'KennedyTedesco Validation' - The power of 'Respect Validation' on Laravel.

2832.4k4](/packages/resultsystems-validation)[iamfarhad/validation

🇮🇷 Complete Laravel Persian validation package - Iranian national ID, mobile numbers, Shamsi dates, IBAN/Sheba, postal codes &amp; more. Modern Laravel 10-12 support with both ValidationRule objects &amp; string-based rules.

2917.3k](/packages/iamfarhad-validation)[iutrace/laravel-cuit-validator

Argentinian CUIT and CUIL Validator

1013.3k](/packages/iutrace-laravel-cuit-validator)

PHPackages © 2026

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