PHPackages                             sinarajabpour1998/alpha-helper - 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. sinarajabpour1998/alpha-helper

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

sinarajabpour1998/alpha-helper
==============================

Provides helper functions and validators in laravel.

v3.2(1y ago)01414MITPHPPHP ^7.1.3|8.\*

Since Sep 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sinarajabpour1998/alpha-helper)[ Packagist](https://packagist.org/packages/sinarajabpour1998/alpha-helper)[ Docs](https://github.com/sinarajabpour1998/alpha-helper)[ RSS](/packages/sinarajabpour1998-alpha-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (16)Used By (4)

Laravel Alpha Helper
====================

[](#laravel-alpha-helper)

[![GitHub issues](https://camo.githubusercontent.com/d0d79322feae1e3880e8ced6ef762966bb89e2ca266e868587e9899e37154af1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f73696e6172616a6162706f7572313939382f616c7068612d68656c7065723f7374796c653d666c61742d737175617265)](https://github.com/sinarajabpour1998/alpha-helper/issues)[![GitHub stars](https://camo.githubusercontent.com/916190db9dcf53c477117ea77f633d033b75429117a7ca104f91e93805674cb8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f73696e6172616a6162706f7572313939382f616c7068612d68656c7065723f7374796c653d666c61742d737175617265)](https://github.com/sinarajabpour1998/alpha-helper/stargazers)[![GitHub forks](https://camo.githubusercontent.com/f336d42a44d6415fc9e48543ae06a287835af5c0ffa8271ea9b1295d0e2df4e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f73696e6172616a6162706f7572313939382f616c7068612d68656c7065723f7374796c653d666c61742d737175617265)](https://github.com/sinarajabpour1998/alpha-helper/network)[![GitHub license](https://camo.githubusercontent.com/0788d77145decfc20ecd9bee653654633f3414eeacc76775fdaa3d8c2d774f43/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73696e6172616a6162706f7572313939382f616c7068612d68656c7065723f7374796c653d666c61742d737175617265)](https://github.com/sinarajabpour1998/alpha-helper/blob/master/LICENSE)

### Quick links

[](#quick-links)

- [Installation](#installation)
- [Publish Config file](#publish-config-file)
- [Helper functions and facades that exists in package](#helper-functions-and-facades-that-exists-in-package)
- [Helper Functions Usage](#helper-functions-usage)
- [Validators that exists in package](#validators-that-exists-in-package)
- [Validators Usage](#validators-usage)
- [Categories Usage](#categories-usage)
- [Requirements](#requirements)

### Installation

[](#installation)

```

composer require sinarajabpour1998/alpha-helper

```

#### Publish Config file

[](#publish-config-file)

```

php artisan vendor:publish --tag=alpha-helper

```

#### Helper functions and facades that exists in package

[](#helper-functions-and-facades-that-exists-in-package)

```
1. integerToken($length = 5) : Generate integer token or code

2. stringToken($length = 16, $characters = '2345679acdefghjkmnpqrstuvwxyz') : Generate string token or code

3. digitsToEastern($number) : Covert a Weatern number(English) or digits to Eastern number(Persian or Arabic)

4. easternToDigits($number) : Covert a Eastern number(Persion, Arabic) to Eastern number(English)

5. isActive($key, $activeClassName = 'active') : Check the route name(string) or route names(array) is avtive or no for css classes

6. prepareInteger(input: string or integer) : removes `,` from integer (can be used in request for prices)

7. prepareSlug(slug, title, model) : generate clean slug from title and checks slug unique in specific model

8. encryptString(string data) : encrypts data using Crypt and returns encrypted data

9. decryptString(string encryptedString) : decrypts data using Crypt and returns decrypted data

10. makeHash(string) : make hash using sha512 from string

11. getSettingsKey(string key) : get settings specific key, returns a value, you must have a settings model with key-value structure

12. isMobile(string) : check if string is a valid mobile number

..

```

#### Helper Functions Usage

[](#helper-functions-usage)

```
## With Facade format:

AlphaHelper::integerToken(length: 10);
AlphaHelper::stringToken(length: 32, characters: '2345679acdefghjkmnpqrstuvwxyz');
AlphaHelper::digitsToEastern(number: 1375);
AlphaHelper::easternToDigits(number: ۱۳۷۵);
AlphaHelper::isActive(key: ['posts.index', 'posts.create', 'posts.edit'], activeClassName: 'acive');
AlphaHelper::prepareInteger(input: string or integer);
AlphaHelper::prepareSlug(slug, title, model);
AlphaHelper::encryptString(data [string type]);
AlphaHelper::decryptString(data [string type]);
AlphaHelper::makeHash(data [string type]);
AlphaHelper::getSettingsKey(key [string type]);
AlphaHelper::isMobile(string);

## Call a helper function:

integerToken(length: 10)
stringToken(length: 32, characters: '2345679acdefghjkmnpqrstuvwxyz');
digitsToEastern(number: 1375);
easternToDigits(number: ۱۲۳۴۵);
isActive(key: ['posts.index', 'posts.create', 'posts.edit'], activeClassName: 'acive');
prepareInteger(input: string or integer);
prepareSlug(slug, title, model);
encryptString(data [string type]);
decryptString(data [string type]);
makeHash(data [string type]);
getSettingsKey(string key);
isMobile(string);

```

#### Validators that exists in package

[](#validators-that-exists-in-package)

- National Code (کد ملی)
- IBAN (شماره شبا)
- Debit Card (شماره کارت بانکی)
- Postal Code (کد پستی)
- Shenase Meli (شناسه ملی)
- Mobile (موبایل)
- Phone (تلفن ثابت)
- Unique Dynamic (تشخیص یکتایی دو ستونه)
- Persian Alphabetic (الفبای فارسی)
- Persian Number (اعداد فارسی)
- No Special Chars (بدون کاراکتر خاص)
- Address (آدرس)

#### Validators Usage

[](#validators-usage)

> national\_code
>
> A rule for validating Iranian national code [(How calculated)](https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%AA_%D8%B4%D9%86%D8%A7%D8%B3%D8%A7%DB%8C%DB%8C_%D9%85%D9%84%DB%8C#%D8%AD%D8%B3%D8%A7%D8%A8_%DA%A9%D8%B1%D8%AF%D9%86_%DA%A9%D8%AF_%DA%A9%D9%86%D8%AA%D8%B1%D9%84)

```
return [
    'code' => 'required|national_code'
];

For national_code with exeptions code or valid codes for foreign national codes
First step for use this parameters is migrate, php artisan migrate, and save your exeptions in this table
but if you want to use another table you can set your table and column
return [
    'code' => 'required|national_code:national_code_exceptions' // This is default table that contains exeption codes
    -- OR --
    'code' => 'required|national_code:national_code_exceptions,code' // Second parameter is column of exeption table
];

-- OR --

return [
    'code' => ['required', 'national_code']
];

-- OR --

$validatedData = $request->validate([
    'code' => 'national_code',
]);

```

> iban
>
> A rule for validating IBAN (International Bank Account Number) known in Iran as Sheba. [(How calculated)](https://fa.wikipedia.org/wiki/%D8%A7%D9%84%DA%AF%D9%88%D8%B1%DB%8C%D8%AA%D9%85_%DA%A9%D8%AF_%D8%B4%D8%A8%D8%A7#%D8%A7%D9%84%DA%AF%D9%88%D8%B1%DB%8C%D8%AA%D9%85_%DA%A9%D8%AF_%D8%B4%D8%A8%D8%A7)

```
return [
    'account' => 'iban'
];

-- OR --

Add `false` optional parameter after `iban`, If IBAN doesn't begin with `IR`, so the validator will add `IR` as default to the account number:
return [
    'account' => 'iban:false'
];

-- OR --

If you want to validate non Iranian IBAN, add the 2 letters of country code after `false` optional parameter:
return [
    'account' => 'iban:false,DE'
];

```

> debit\_card
>
> A rule for validating Iranian debit cards. [(How calculated)](http://www.aliarash.com/article/creditcart/credit-debit-cart.htm)

```
return [
    'code' => 'required|debit_card'
];

-- OR --

return [
    'code' => ['required', 'debit_card']
];

-- OR --

$validatedData = $request->validate([
    'code' => 'debit_card',
]);

-- OR --

You can add an optional parameter if you want to validate a card from a specific bank:
return [
    'code' => 'required|debit_card:bmi'
];

List of the bank codes:

 - bmi (بانک ملی)
 - banksepah (بانک سپه)
 - edbi (بانک توصعه صادرات)
 - bim (بانک صنعت و معدن)
 - bki (بانک کشاورزی)
 - bank-maskan (بانک مسکن)
 - postbank (پست بانک ایران)
 - ttbank (بانک توسعه تعاون)
 - enbank (بانک اقتصاد نوین)
 - parsian-bank (بانک پارسیان)
 - bpi (بانک پاسارگاد)
 - karafarinbank (بانک کارآفرین)
 - sb24 (بانک سامان)
 - sinabank (بانک سینا)
 - sbank (بانک سرمایه)
 - shahr-bank (بانک شهر)
 - bank-day (بانک دی)
 - bsi (بانک صادرات)
 - bankmellat (بانک ملت)
 - tejaratbank (بانک تجارت)
 - refah-bank (بانک رفاه)
 - ansarbank (بانک انصار)
 - mebank (بانک مهر اقتصاد)

```

> postal\_code

```
return [
    'code' => 'required|postal_code'
];

--OR--

return [
    'code' => ['required, 'postal_code']
];

--OR--

$validatedData = $request->validate([
    'code' => 'postal_code',
]);

```

> shenase\_meli
>
> A rule for validating Iranian shenase meli [(How calculated)](http://www.aliarash.com/article/shenasameli/shenasa_meli.htm)

```
return [
    'code' => 'required|shenase_meli'
];

--OR--

return [
    'code' => ['required, 'shenase_meli']
];

--OR--

$validatedData = $request->validate([
    'code' => 'shenase_meli',
]);

```

> mobile

```
return [
    'mobile' => 'required|mobile'
];

--OR--

return [
    'mobile' => ['required, 'mobile']
];

--OR--

$validatedData = $request->validate([
    'mobile' => 'mobile',
]);

```

> username (Valid characters: English Alphabetic, Numbers and \_)

```
return [
    'username' => 'required|username'
];

--OR--

return [
    'username' => ['required, 'username']
];

--OR--

$validatedData = $request->validate([
    'username' => 'username',
]);

```

> phone

```
return [
    'phone' => 'required|phone'
];

--OR--

return [
    'phone' => ['required, 'phone']
];

--OR--

$validatedData = $request->validate([
    'phone' => 'phone',
]);

```

> unique\_dynamic (table\_name, target\_column, extra\_column, extra\_column\_value, ignore\_column, ignore\_column\_value)

```
return [
    // Without ignore for create user, 4 parameters
    // If we want to check a username is unique in users table when type of this useranme equal student
    // If username = 'v.ashourzadeh' and type = 'student' you can't create username = 'v.ashourzadeh' but create username = 'v.ashourzadeh' if type = 'teacher'
    'username' => 'required|unique_dynamic:users,username,type,student'

    // With ignore for edit user, 6 parameters
    // If we want to check a username is unique in users table and ignore this for special id, for example id = 5
    // If username = 'v.ashourzadeh' and type = 'student' you can set username = 'v.ashourzadeh' when id = 5
    'username' => 'required|unique_dynamic:users,username,type,student,id,5'
];

--OR--

return [
    // Without ignore for create user, 4 parameters
    'username' => ['required, 'unique_dynamic:users,username,type,student']

    // With ignore for edit user, 6 parameter
    'username' => ['required, 'unique_dynamic:users,username,type,student,id,5']
];

--OR--

$validatedData = $request->validate([
    // Without ignore for create user, 4 parameters
    'username' => 'unique_dynamic:users,username,type,student',
    // With ignore for edit user, 6 parameter
    'username' => 'unique_dynamic:users,username,type,student,id,5',
]);

```

> persian\_alphabetic

```
return [
    'code' => 'required|persian_alphabetic'
];

--OR--

return [
    'code' => ['required, 'persian_alphabetic']
];

--OR--

$validatedData = $request->validate([
    'code' => 'persian_alphabetic',
]);

```

> persian\_number

```
return [
    'code' => 'required|persian_number'
];

--OR--

return [
    'code' => ['required, 'persian_number']
];

--OR--

$validatedData = $request->validate([
    'code' => 'persian_number',
]);

```

> no\_special\_chars

```
return [
    'name' => 'required|no_special_chars'
];

--OR--

return [
    'name' => ['required, 'no_special_chars']
];

--OR--

$validatedData = $request->validate([
    'name' => 'no_special_chars',
]);

```

> address

```
return [
    'address' => 'required|address'
];

--OR--

return [
    'address' => ['required, 'address']
];

--OR--

$validatedData = $request->validate([
    'address' => 'address',
]);

```

#### Categories Usage

[](#categories-usage)

This package provides category handling for blew table structure with `Category` model:

categories =&gt; `id, slug, title, category_type, description, parent_id, creator_id`

categorizables =&gt; `category_id, categorizable_id, categorizable_type`

> Usage in category create blade :

``

- this tag generates select options , so you can use it in select or select2 tags.
- type: the category type used in the table structure, for example postCategory
- page: the blade page that contains the current tag

> Usage in category edit blade:

``

- parent: that contains current category parent\_id
- category: that contains current category\_id

> Usage in specific create blade that contains category:

``

- this tag generates checkboxes , so you can use it in any div tag.
- type: the category type used in the table structure, for example postCategory
- page: the blade page that contains the current tag

> Usage in specific edit blade that contains category:

``

- checked: an array that contains synced categories with the main object, for example services-&gt;categories

#### Requirements:

[](#requirements)

- PHP v7.0 or above
- Laravel v7.0 or above

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance44

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community13

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 ~90 days

Recently: every ~274 days

Total

15

Last Release

436d ago

Major Versions

v1.5 → v2.02024-01-27

v2.0 → v3.02024-06-11

### Community

Maintainers

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

---

Top Contributors

[![sinatx](https://avatars.githubusercontent.com/u/76904071?v=4)](https://github.com/sinatx "sinatx (16 commits)")

---

Tags

phplaravelvalidationhelperscodenationalfunctionscategorycompanylaravel12laravel11IBANlaravel8laravel9laravel-helpersdebitlaravel7laravel10mellinational idshebalaravel7-packageshenase-mellilaravel8-packagelaravel10-packagelaravel9-package

### Embed Badge

![Health badge](/badges/sinarajabpour1998-alpha-helper/health.svg)

```
[![Health](https://phpackages.com/badges/sinarajabpour1998-alpha-helper/health.svg)](https://phpackages.com/packages/sinarajabpour1998-alpha-helper)
```

###  Alternatives

[onecentlin/laravel-adminer

Laravel Adminer Database Manager

260491.1k3](/packages/onecentlin-laravel-adminer)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[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)[yorcreative/laravel-argonaut-dto

Argonaut is a lightweight Data Transfer Object (DTO) package for Laravel that supports nested casting, recursive serialization, and validation out of the box. Ideal for service layers, APIs, and clean architecture workflows.

1062.8k1](/packages/yorcreative-laravel-argonaut-dto)[salmanzafar/laravel-geocode

A Laravel Library to find Lat and Long of a given Specific Address

153.9k](/packages/salmanzafar-laravel-geocode)

PHPackages © 2026

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