承接 tavo1987/laravel-ec-validator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

tavo1987/laravel-ec-validator

最新稳定版本:v3.0.1

Composer 安装命令:

composer require tavo1987/laravel-ec-validator

包简介

Laravel validation rules for Ecuadorian identification numbers (Cédula and RUC)

README 文档

README

Tests Latest Stable Version Total Downloads License

Laravel validation rules for Ecuadorian identification numbers. Easily validate:

  • Cédula (Ecuadorian ID card)
  • RUC for natural persons
  • RUC for private companies
  • RUC for public companies

Requirements

  • PHP 8.2 or higher
  • Laravel 11.x or 12.x

Introduction

This package depends on ec-validador-cedula-ruc. If you want to learn more about the validation logic, you can read the article How to validate Cédula and RUC in Ecuador (Spanish), which details the manual process.

Installation

composer require tavo1987/laravel-ec-validator

The service provider is auto-discovered by Laravel. No manual registration required.

Manual Registration (Optional)

If you have disabled auto-discovery, add the service provider to your config/app.php:

'providers' => [
    Tavo\EcLaravelValidator\EcValidatorServiceProvider::class,
];

Usage

Use the custom validation rules in your validation logic:

// Validate Cédula (ID card)
$this->validate($request, [
    'cedula' => 'ecuador:ci',
]);

// Validate RUC for natural person
$this->validate($request, [
    'ruc' => 'ecuador:ruc',
]);

// Validate RUC for public company
$this->validate($request, [
    'ruc' => 'ecuador:ruc_spub',
]);

// Validate RUC for private company
$this->validate($request, [
    'ruc' => 'ecuador:ruc_spriv',
]);

Available Rules

Rule Description
ecuador:ci Validates Ecuadorian Cédula (10 digits)
ecuador:ruc Validates RUC for natural persons (13 digits)
ecuador:ruc_spub Validates RUC for public companies (13 digits)
ecuador:ruc_spriv Validates RUC for private companies (13 digits)

Using with Form Requests

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StoreClientRequest extends FormRequest
{
    public function rules(): array
    {
        return [
            'cedula' => ['required', 'ecuador:ci'],
            'ruc' => ['nullable', 'ecuador:ruc'],
        ];
    }
}

What's New in v3.0.1

Bug Fixes

  • Updated ec-validador-cedula-ruc to v2.0.1
  • Fixed validation for private company RUCs (ruc_spriv) with 7-digit extended sequential numbers
  • Per SRI rules, RUCs exceeding 999999 in sequential value no longer require modulo 11 check digit validation

What's New in v3.0.0

Breaking Changes

  • PHP 8.2+ required (dropped PHP 7.x support)
  • Laravel 11/12 only (dropped Laravel 7.x-10.x support)
  • Internal method names updated to English API (transparent to users)

Version Requirements

Requirement v1.x/v2.x v3.0
PHP ^7.2.5 ^8.2
Laravel ^7.4.0 ^11.0 | ^12.0

New Features

  • PHP 8.2+ typed properties and return types
  • PHPUnit 11 with #[Test] attributes
  • GitHub Actions CI for PHP 8.2, 8.3, 8.4
  • Updated to ec-validador-cedula-ruc v2.0 with English API

Upgrading from v2.x

Update your composer.json:

composer require tavo1987/laravel-ec-validator:^3.0

The validation rules (ecuador:ci, ecuador:ruc, etc.) remain unchanged.

Tests

The package includes a PHPUnit test suite:

./vendor/bin/phpunit

Contributing

If you find a bug or want to add functionality, please feel free to open an issue or submit a pull request. Contributions must follow these rules:

  • All tests must pass
  • New functionality must include tests

Authors

Edwin Ramírez

Bryan Suárez

License

This package is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-02