ibericode/vat-bundle
Composer 安装命令:
composer require ibericode/vat-bundle
包简介
Bundle for using ibericode/vat in a Symfony environment
关键字:
README 文档
README
This bundle allows you to use ibericode/vat in your Symfony projects.
- Fetch VAT rates for any European member state from ibericode/vat-rates
- Validate VAT numbers (by format and existence)
- Validate ISO-3316 alpha-2 country codes
- Determine whether a country is part of the EU
- Geo-locate IP addresses
The official VIES VAT number validation SOAP API is used for validating VAT numbers.
Installation
First, install the bundle using Composer.
composer require ibericode/vat-bundle
Then, load the bundle by adding it to your config/bundles.php file.
Ibericode\Vat\Bundle\VatBundle::class => ['all' => true]
Usage
Check out ibericode/vat for direct usage examples. This bundle adds service configuration & a validation constraint for VAT numbers.
Dependency injection
With this bundle enabled, you can use dependency injection to retrieve a class instance for the Countries, Validator, Rates or Geolocator classes.
use Ibericode\Vat\Countries; use Ibericode\Vat\Validator; use Ibericode\Vat\Rates; use Ibericode\Vat\Geolocator; class MyController { /** * Type-hint the class on your service constructors to retrieve a class instance */ public function __construct( Rates $rates, Validator $validator, Countries $countries, Geolocator $geolocator ) { $rates->getRateForCountry('NL'); // 21.00 $validator->validateVatNumber('NL123456789B01'); // false $countries->isCountryCodeInEU('US') // false $geolocator->locateIpAddress('8.8.8.8'); // US } }
Validation
To validate a VAT number using Symfony's Validation component, you can use the VatNumber constraint.
use Ibericode\Vat\Bundle\Validator\Constraints\VatNumber; class Customer { /** * @VatNumber() */ public $vatNumber; }
License
MIT licensed. See the LICENSE file for details.
ibericode/vat-bundle 适用场景与选型建议
ibericode/vat-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 276.13k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2019 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「vat」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ibericode/vat-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ibericode/vat-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ibericode/vat-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A VAT number check (Web Service) Plugin for CakePHP
Validate the format of EU vat numbers.
PHP VAT checker based on the European Commission web service
A library to deal with VAT Numbers within Teamleader CRM
Totals, subtotals, linetotals, VAT-calculations and proper rounding for invoices.
Simple package to check European's VAT number format
统计信息
- 总下载量: 276.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 21
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 3
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-07