padam87/address-bundle
Composer 安装命令:
composer require padam87/address-bundle
包简介
Symfony2 AddressBundle
README 文档
README
1, Installation
1.1 Composer
composer require padam87/address-bundle
1.2 AppKernel
// app/AppKernel.php public function registerBundles() { return array( // ... new Padam87\AddressBundle\Padam87AddressBundle(), ); }
2, Usage
Use the traits and embeddables with your schema.
2.1 Formatter
$formatted = $this->get("padam87.address.formatter")->format($address);
Flags
use Padam87\AddressBundle\Service\FormatterService; //... $formatted = $this->get("padam87.address.formatter")->format($address, FormatterService::FLAG_NOBR);
Available flags
FLAG_NOBRNo linebreak will be addedFLAG_HTMLOutputs the address in html format
Extend / override templates
You can override or extend the language-specific formats. Just create the appropriate template under app\Resources\Padam87AddressBundle\views
example: app\Resources\Padam87AddressBundle\views\US.twig
contributing: Create a PR with your own country's format :)
2.2 Twig extension
{{ address|address()|raw }}
This will output the formatted address, with the FLAG_HTML added by default
统计信息
- 总下载量: 13.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-04-17