springy-framework/brazilian-numbers 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

springy-framework/brazilian-numbers

Composer 安装命令:

composer require springy-framework/brazilian-numbers

包简介

PHP class for validate and check brazilian document and numbers

README 文档

README

This package can validate documents like CPF, CNPJ, CNH, NIS and "inscrição estadual".

It can take the strings with the numbers of documents of people and companies from Brazil and perform format and check digit verifications to determine if they can be valid.

Latest Stable Version Tests Total Downloads License

Requirements

  • PHP 8.1+

Instalation

To get the latest stable version of this component use:

"require": {
    "springy-framework/brazilian-numbers": "*"
}

in your composer.json file.

Usage

I suppose that the following example is all you need:

<?php

require 'vendor/autoload.php'; // If you're using Composer (recommended)

// The following numbers can also be used without a mask.
$cpf = '899.678.736-12';
$cnpj = '76.871.442/0001-75';
$cnh = '21059294129';
$nis = '640.58791.38-4';
$ierj = '18.251.03-5';

if (Springy\Utils\BrazilianNumbers\Cpf::isValid($cpf)) {
    echo "CPF valid!\n";
} else {
    echo "CPF invalid!\n";
}

if (Springy\Utils\BrazilianNumbers\Cnpj::isValid($cnpj)) {
    echo "CNPJ valid!\n";
} else {
    echo "CNPJ invalid!\n";
}

if (Springy\Utils\BrazilianNumbers\Cnh::isValid($cnh)) {
    echo "CNH valid!\n";
} else {
    echo "CNH invalid!\n";
}

if (Springy\Utils\BrazilianNumbers\Nis::isValid($nis)) {
    echo "NIS valid!\n";
} else {
    echo "NIS invalid!\n";
}

if (Springy\Utils\BrazilianNumbers\InscricaoEstadual::isValid($ierj)) {
    echo "IE valid!\n";
} else {
    echo "IE invalid!\n";
}

echo Springy\Utils\BrazilianNumbers\Cpf::mask('89967873612');
echo Springy\Utils\BrazilianNumbers\Cnpj::mask('76871442000175');
echo Springy\Utils\BrazilianNumbers\Nis::mask('64058791384');
echo Springy\Utils\BrazilianNumbers\InscricaoEstadual::mask('18251035');
echo Springy\Utils\BrazilianNumbers\Cpf::unmask($cpf);
echo Springy\Utils\BrazilianNumbers\Cnpj::unmask($cnpj);
echo Springy\Utils\BrazilianNumbers\Nis::unmask($nis);
echo Springy\Utils\BrazilianNumbers\InscricaoEstadual::unmask($ierj);

Contributing

Please read our contributing document and thank you for doing that.

Code of Conduct

In order to ensure that our community is welcoming to all, please review and abide by the code of conduct.

License

This project is licensed under The MIT License (MIT).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固