定制 trustinsurance/ibanvalidator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

trustinsurance/ibanvalidator

最新稳定版本:v1.0.0

Composer 安装命令:

composer require trustinsurance/ibanvalidator

包简介

Laravel package to validate IBAN and BIC

README 文档

README

A lightweight Laravel package to validate IBAN and BIC codes.
This package simplifies validating international bank account numbers (IBAN) and bank identifier codes (BIC) using simple, reliable logic.

📦 Installation

Step 1: Require the package via Composer

composer require trustinsurance/ibanvalidator:^1.0


#Usage


Option 1: Dependency Injection
use Illuminate\Http\Request;
use Trustinsurance\IbanValidator\IbanValidator;

class PaymentController extends Controller
{
    protected $validator;

    public function __construct(IbanValidator $validator)
    {
        $this->validator = $validator;
    }

    public function validateBankDetails(Request $request)
    {
        $iban = 'CY17002001280000001200527600';
        $bic = 'CBCYCY2N';

        return response()->json([
            'iban_valid' => $this->validator->validateIban($iban),
            'bic_valid' => $this->validator->validateBic($bic),
        ]);
    }
}
Option 2: Facade Usage


use IbanValidator;

$iban = 'CY17002001280000001200527600';
$bic = 'CBCYCY2N';

$isIbanValid = IbanValidator::validateIban($iban);
$isBicValid = IbanValidator::validateBic($bic);

Validation Rules
IBAN Validation Logic

The IBAN validator checks the following:

    Removes all spaces

    Moves the first 4 characters to the end

    Converts alphabetic characters to numbers (A = 10, B = 11, ..., Z = 35)

    Computes mod 97 and checks if result equals 1

Example (Cyprus):

    CY17002001280000001200527600 → ✅ Valid

BIC Validation Logic

Validates BIC format using regex:

    8 or 11 characters

    Structure: BBBBCCLL or BBBBCCLLXXX

        BBBB: Bank code (letters)

        CC: Country code (letters)

        LL: Location code (alphanumeric)

        XXX: Optional branch code (alphanumeric)

Example:

    CBCYCY2N → ✅ Valid

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固