germania-kg/vatidno
Composer 安装命令:
composer require germania-kg/vatidno
包简介
Interfaces and traits for VAT ID numbers.
README 文档
README
Interfaces, traits, and filters for dealing with VAT ID numbers
Installation
$ composer require germania-kg/vatidno
Interfaces
VatIdNoProviderInterface
Provides a method VatIdNo to retrieve the VATIN as string.
use Germania\VatIdNo\VatIdNoProviderInterface; /** * @return string */ public function getVatIdNo();
VatIdNoAwareInterface
Extends VatIdNoProviderInterface and provides a method setVatIdNo, allowing you to set the VATIN.
use Germania\VatIdNo\VatIdNoProviderInterface; /** * @param string $vatin * @return self */ public function setVatIdNo( $vatin ); public function getVatIdNo();
Traits
VatIdNoProviderTrait
Implements the VatIdNoProviderInterface and provides a public property vatin:
use Germania\VatIdNo\VatIdNoProviderInterface; use Germania\VatIdNo\VatIdNoProviderTrait; class MyClass implements VatIdNoProviderInterface { use VatIdNoProviderTrait; public function __construct( $vatin ) { $this->vatin = $vatin; } }
VatIdNoAwareTrait
Implements the VatIdNoAwareInterface. Utilizes the VatIdNoProviderTrait.
use Germania\VatIdNo\VatIdNoAwareInterface; use Germania\VatIdNo\VatIdNoAwareTrait; class MyClass implements VatIdNoAwareInterface { use VatIdNoAwareTrait; } // Simple example $object1 = new MyClass; $object1->setVatIdNo( "XY000000" ); // Fluent interface echo $object1->setVatIdNo( "XY000000" )->vatin; // Setting using VatIdNoProviderInterface $object2 = new MyClass; $object2->setVatIdNo( $object1 );
Filters
WithVatIdNoFilterIterator
Filter for records that do provide a VATIN. These may be:
- Arrays with
vatinkey, and non-empty value - Objects with
vatinproperty, and non-empty value - Instances of
VatIdNoProviderInterfacewhere getVatIdNo results not empty
<?php use Germania\VatIdNo\Filters\WithVatIdNoFilterIterator; $records = new \ArrayIterator( ask_database() ); // Allow custom field names in arrays or objects $records_with_vatin = new WithoutVatIdNoFilterIterator( $records ); $records_with_vatin = new WithoutVatIdNoFilterIterator( $records, "ust_id" ); foreach( $records_with_vatin as $item): // Do things like validating endforeach;
WithoutVatIdNoFilterIterator
Filter for records that do not provide a VATIN. These may be:
- Arrays lacking
vatinkey, or emptyvatinelement - Objects lacking
vatinproperty, or emptyvatinproperty - Instances of
VatIdNoProviderInterfacewhere getVatIdNo results empty
<?php use Germania\VatIdNo\Filters\WithoutVatIdNoFilterIterator; $records = new \ArrayIterator( ask_database() ); // Allow custom field names in arrays or objects $records_lacking = new WithoutVatIdNoFilterIterator( $records ); $records_lacking = new WithoutVatIdNoFilterIterator( $records, "ust_id" ); foreach( $records_lacking as item): //... endforeach;
Validation
To validate the VAT ID numbers, use a dedicated package like David de Boer's ddeboer/vatin package.
Development
$ git clone https://github.com/GermaniaKG/VatIdNo.git
$ cd VatIdNo
$ composer install
Unit tests
Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:
$ composer test # or $ vendor/bin/phpunit
germania-kg/vatidno 适用场景与选型建议
germania-kg/vatidno 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 103 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 04 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「vat」 「filters」 「interfaces」 「traits」 「VAT ID Number」 「VAT ID No」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 germania-kg/vatidno 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 germania-kg/vatidno 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 germania-kg/vatidno 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A VAT number check (Web Service) Plugin for CakePHP
O2System PSR it's build based on PHP Framework Interop Group (PHP-FIG) standards recommendations. This repository contains a collection of PHP interfaces based on the PSR-0 until the PSR-7.
Simple filters for laravel
Validate the format of EU vat numbers.
Limoncello PHP Framework Contracts (interfaces) required for components integration.
PHP VAT checker based on the European Commission web service
统计信息
- 总下载量: 103
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2018-04-16