feft/address-bundle
Composer 安装命令:
composer require feft/address-bundle
包简介
This is a Symfony2 bundle that lets using international mailing address.
关键字:
README 文档
README
Address
International mailing address created in Symfony2. Format examples on http://www.bitboost.com/ref/international-address-formats.html#Formats
The code is compatible with php 7.1 and 5.6 versions.
Installation
Install the library using composer. Add the new line to your composer.json file:
{
"require": {
"feft/address-bundle": "dev-master"
},
}
Now run the install command.
$ php composer.phar install
or use Makefile (only if you are using Docker):
make composer
PhpUnit
To run unittests use command (only if you are using Docker):
make php5.6-phpunit5
Enable the bundle
Enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new \Feft\AddressBundle\FeftAddressBundle(), ); }
Update doctrine schema
$ php app/console doctrine:schema:update --force
CRUD operations
Every entity has CRUD Controller to show/add/edit/delete operation, eg. to manage countries use link like this: http://localhost/address/web/app.php/country/
Usage
Simple use:
$factory = new AddressFactory(); $addressData = array( "countryName" => "Poland", "countryAlpha2Code" => "PL", "countryLocalShortName" => "Polska", "localityName" => "Tychy", "regionName" => "śląskie", "streetName" => "Freedom", "postalCode" => "43-100", "streetNumber" => "20 m. 21", ); $address = $factory->getAddressObject($addressData); return array( 'address' => $address, );
For more examples see unit tests folder.
Controller file:
use Feft\AddressBundle\Entity\Address; use Feft\AddressBundle\Entity\Country; use Feft\AddressBundle\Entity\Locality; use Feft\AddressBundle\Entity\PostalCode; use Feft\AddressBundle\Entity\Region; use Feft\AddressBundle\Entity\Street; use Feft\AddressBundle\Model\PostalValidator\Factory; $country = new Country("Poland","PL"); $country->setLocalShortName("Polska"); $locality = new Locality(); $locality->setName("Tychy"); $region = new Region(); $region->setName("śląskie"); $locality->setRegion($region); $country->addRegion($locality->getRegion()); $locality->getRegion()->setCountry($country); $street = new Street(); $street->setName("Wolności"); $code = new PostalCode(); $code->setCode("43-100"); $code->setValidator(Factory::getInstance($code,$country->getCode())); $address = new Address(); $address->setCountry($country); $address->setRegion($region); $address->setLocality($locality); $address->setStreet($street); $address->setNumber("20 m. 21"); $address->setPostalCode($code); $codeValidatingResult = $code->validate(); $options = array("showCountryName" => true); return array( 'address' => $address, "options" => $options );
Twig file:
<p> {{ address_formatter(address,options)|raw }} </p> <p>or inline format: {{ address_inline_formatter(address,options) }} </p>
Html result:
Wolności 20 m. 21
43-100 Tychy
Poland
or inline format: Wolności 20 m. 21, 43-100 Tychy, Poland
Authors
The bundle was created by Piotr Pikuła. See the list of contributors.
feft/address-bundle 适用场景与选型建议
feft/address-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 41 次下载、GitHub Stars 达 2, 最近一次更新时间为 2014 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「address」 「validator」 「post」 「postal」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 feft/address-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 feft/address-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 feft/address-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Maps in minutes. Powered by the Google Maps API.
Redirects TYPO3 visitors automatic or with a suggestlink to another language and/or root page.
Runn Me! Validation and Sanitization Library
Symfony bundle that integrates the PostNord PHP SDK
Extension for Opis JSON Schema
Module adding custom shipping attribute for what3words address
统计信息
- 总下载量: 41
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-11-29