avto-dev/identity-laravel
Composer 安装命令:
composer require avto-dev/identity-laravel
包简介
IDEntity for Laravel
README 文档
README
IDEntity
IDEntity (identification entities) is objects with implemented methods of validation, normalization, and optional automatic type determination.
Installation
Require this package with composer using the next command:
$ composer require avto-dev/identity-laravel "^6.0"
Installed
composeris required. To install composer, please click here.
Please note that you need to fix the major version of the package.
After that you can "publish" configuration file (./config/identity.php) using next command:
$ ./artisan vendor:publish --provider="AvtoDev\IDEntity\ServiceProvider"
Usage
Below you can find some usage examples.
Type detection:
use AvtoDev\IDEntity\IDEntity; IDEntity::is('JF1SJ5LC5DG048667', IDEntity::ID_TYPE_VIN); // true IDEntity::is('A123AA177', IDEntity::ID_TYPE_VIN); // false IDEntity::is('JF1SJ5LC5DG048667', IDEntity::ID_TYPE_GRZ); // false IDEntity::is('A123AA177', IDEntity::ID_TYPE_GRZ); // true IDEntity::is('14:36:102034:2256', IDEntity::ID_TYPE_CADASTRAL_NUMBER); // true IDEntity::is('JF1SJ5LC5DG048667', IDEntity::ID_TYPE_CADASTRAL_NUMBER); // false $valid_vin = IDEntity::make('JF1SJ5LC5DG048667', IDEntity::ID_TYPE_VIN); $valid_vin->isValid(); // true $invalid_vin = IDEntity::make('SOME INVALID', IDEntity::ID_TYPE_VIN); $invalid_vin->isValid(); // false
Entities creation:
use AvtoDev\IDEntity\IDEntity; use AvtoDev\IDEntity\Types\IDEntityCadastralNumber; $vin = IDEntity::make('JF1SJ5LC5DG048667'); $vin->getType(); // 'VIN' $vin->getValue(); // 'JF1SJ5LC5DG048667' $vin->isValid(); // true \get_class($vin); // 'AvtoDev\IDEntity\Types\IDEntityVin' $cadastral_number = new IDEntityCadastralNumber('10:01:0030104:691'); $cadastral_number->getType(); // 'CADNUM' $cadastral_number->isValid(); // true
Some typed entity classes contains a lot of additional methods for a working with passed value.
Value normalization:
use AvtoDev\IDEntity\IDEntity; use AvtoDev\IDEntity\Types\IDEntityVin; $vin = new IDEntityVin(' jf1SJ5LC5DG048 667'); $vin->getValue(); // 'JF1SJ5LC5DG048667' IDEntity::make(' a123аY777', IDEntity::ID_TYPE_GRZ)->getValue(); // 'А123АУ777'
Value masking:
<?php use AvtoDev\IDEntity\Types\IDEntityVin; $vin = IDEntityVin::make('JF1SJ5LC5DG048667'); $vin->getMaskedValue(2, 4); // JF***********8667 $vin->getMaskedValue(4, 2, '_'); // JF1S___________67
Testing
For package testing we use phpunit framework and docker-ce + docker-compose as develop environment. So, just write into your terminal after repository cloning:
$ make build $ make latest # or 'make lowest' $ make test
Changes log
Changes log can be found here.
Support
If you will find any package errors, please, make an issue in current repository.
License
This is open-sourced software licensed under the MIT License.
avto-dev/identity-laravel 适用场景与选型建议
avto-dev/identity-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30.17k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2018 年 02 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「identity」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 avto-dev/identity-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 avto-dev/identity-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 avto-dev/identity-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Identity authorizator class for Nette Framework
Identity ACL extension for Nette Framework
Alfabank REST API integration
AXIUM Identity Symfony Bundle - Client d'authentification centralisée OAuth2/Keycloak
Laravel 中国身份证验证
A simply better OAuth2 Client
统计信息
- 总下载量: 30.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 6
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-06