algeriany/libyan-guard

A Laravel package for validating and normalizing Libyan phone numbers and bank IBANs.

Maintainers

Package info

github.com/AlgeRiany01/libyan-guard

pkg:composer/algeriany/libyan-guard

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-08-11 12:46 UTC

This package is auto-updated.

Last update: 2026-08-11 12:51:18 UTC


README

A Laravel package for validating, normalizing, and parsing Libyan phone numbers and local bank IBANs.

Introduction

Libyan Guard is a robust and developer-friendly Laravel package specifically designed to handle Libyan local data structures seamlessly. Whether you are building an e-commerce platform, a financial application, or any service targeting Libyan users, this package provides reliable tools for phone number formatting, network detection, and Libyan bank IBAN validation and parsing.

Installation

You can install the package via Composer. Run the following command in your terminal:

composer require algeriany/libyan-guard

Note: The package utilizes Laravel Package Discovery, meaning the Service Provider and Facades are registered automatically. No manual registration is required.

Usage

1. Phone Numbers (LibyanPhone)

The LibyanPhone facade allows you to easily normalize local and international phone formats, validate numbers, and identify the network provider (Almadar Aljadeed or Libyana).

use algeriany\LibyanGuard\Facades\LibyanPhone;

// Normalize to local format (09xxxxxxxx)
$local = LibyanPhone::normalizeToLocal('+218912345678'); // Returns: 0912345678

// Normalize to international format (+218xxxxxxxxx)
$international = LibyanPhone::normalizeToInternational('0912345678'); // Returns: +218912345678

// Get the network provider ('Madar', 'Libyana', etc.)
$provider = LibyanPhone::getProvider('0912345678'); // Returns: Madar

// Validate phone number format
$isValid = LibyanPhone::isValid('0912345678'); // Returns: true

2. Bank Accounts (LibyanBank)

The LibyanBank facade parses Libyan IBAN details, extracts official bank names in Arabic and English, retrieves SWIFT codes, and validates the IBAN mathematically.

use algeriany\LibyanGuard\Facades\LibyanBank;

$info = LibyanBank::parse('LY22GUMH0000001234567890');

if ($info) {
    echo $info['bank_name_ar'];            // مصرف الجمهورية
    echo $info['swift_code'];              // GUMHLYTR
    echo $info['is_mathematically_valid']; // true / false
}

3. Validation Rules

You can integrate validation directly inside your Controllers or Form Requests using the built-in validation rules:

use Illuminate\Http\Request;

public function store(Request $request)
{
    $request->validate([
        'phone' => ['required', 'libyan_phone'],
        'iban'  => ['required', 'libyan_iban'],
    ]);
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an issue on GitHub for any bugs, feature requests, or improvements.