lucasgiovanny/laravel-serpro-datavalid 问题修复 & 功能扩展

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

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

lucasgiovanny/laravel-serpro-datavalid

Composer 安装命令:

composer require lucasgiovanny/laravel-serpro-datavalid

包简介

Laravel package to easily use Serpro Datavalid API

README 文档

README

Laravel Serpro Datavalid

This package makes it easy to use Serpro Datavalid API with Laravel framework.

GitHub release (latest by date) GitHub

Contents

Installation

This package can be installed via composer:

composer require lucasgiovanny/laravel-serpro-datavalid

Usage

  1. Add your credentials to .env file
SERPRO_DATAVALID_CONSUMER_KEY=
SERPRO_DATAVALID_CONSUMER_SECRET=
SERPRO_DATAVALID_SANDBOX=false
  1. To use this package, you just need to import the Person Facades.
use  LucasGiovanny\SerproDataValid\Person;

Available methods

  • rawValidation: Make a raw validation with any data you need to validate according to Datavalid API Docs.
  • validateName: Returns whether the name belongs to the CPF and its rate of assertiveness.
  • validateGender: Returns whether the CPF has this gender.
  • isBrazilian: Returns whether the person to whom this CPF belongs is Brazilian or not.
  • validateParentsName: Returns whether the parents name belongs to the CPF and its rate of assertiveness.
  • isCPFRegular: Returns if CPF is regular with Brazilian government.
  • validatePhoto: Returns if the person in the photo is the person that owns this CPF number.

rawValidation

Param Type
cpf string (required)
answers array (required)

Example:

use  LucasGiovanny\SerproDataValid\Person;

$data = [
'nome'  =>  "João da Silva",
'sexo' => 'M'
'situacao_cpf'  =>  'regular',
];

$validation = Person::rawValidation("00000000000", $data);

Please, see the Data Valid API docs for a list of all the propriety that can be checked.

validateName

Param Type
cpf string (required)
name string (required)
getSimilarity bool (default: false)

Example:

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::validateName("00000000000", "João da Silva");
//return true or false;
$validation = Person::validateName("00000000000", "João da Silva", true);
//return an object, like:
	// $validation->nome = true;
	// $validation->nome_similaridade = 0.99

validateGender

Param Type
cpf string (required)
gender string (required)

Example:

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::validateGender("00000000000", "F"); // gender needs to be "F" or "M"
//return true or false;

isBrazilian

Param Type
cpf string (required)

Example:

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::isBrazilian("00000000000");
//return true or false;

validateParentsName

Param Type
cpf string (required)
parents array (required)
getSimilarity bool (default: false)

Example:

use  LucasGiovanny\SerproDataValid\Person;

$parents = [
	'mother_name' => 'Eurica Magalhães Souza';
	'father_name' => 'Frederico Fagundes Souza';
]; // you can check just one of the names

$validation = Person::validateParentsName("00000000000", $parents);
//return an object with "mother_name" and "father_name" true or false values;

$validation = Person::validateParentsName("00000000000", $parents, true);
//return an object with "mother_name" and "father_name" true or false values, 
//and "mother_name_similarity" and "father_name_similarity" numbers,
//just like in validateName method.

isCPFRegular

Param Type
cpf string (required)

Example:

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::isCPFRegular("00000000000");
//return true or false;

validatePhoto

Param Type
cpf string (required)
photo string (required)

Example:

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::validatePhoto("00000000000", base64_encode($photo));
//return true or false;

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

Test needs to be written. Feel free to collaborate.

Security

If you discover any security related issues, please email lucasgiovanny@gmail.com instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

lucasgiovanny/laravel-serpro-datavalid 适用场景与选型建议

lucasgiovanny/laravel-serpro-datavalid 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 59 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 06 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「SERPRO」 「datavalid」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 lucasgiovanny/laravel-serpro-datavalid 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 lucasgiovanny/laravel-serpro-datavalid 我们能提供哪些服务?
定制开发 / 二次开发

基于 lucasgiovanny/laravel-serpro-datavalid 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-20