markup/addressing-bundle

将 markup/addressing 与 Symfony2 集成。

安装数: 57,326

依赖者: 0

建议者: 0

安全性: 0

星标: 6

关注者: 12

分支: 4

开放问题: 0

类型:symfony-bundle

0.6.0 2020-08-27 10:09 UTC

This package is auto-updated.

Last update: 2024-09-21 20:41:12 UTC


README

关于

这个 Symfony 扩展包提供了与 markup/addressing 包的集成,该包能够根据Frank's Compulsive Guide To Postal Addresses中设定的规则格式化地址。

安装

将 MarkupAddressingBundle 添加到 composer.json 文件

{
    "require": {
        "markup/addressing-bundle": "@dev"
    }
}

将 MarkupAddressingBundle 添加到 AppKernel.php 文件

    public function registerBundles()
    {
        $bundles = [
            ...
            new Markup\AddressingBundle\MarkupAddressingBundle(),
        ];
        ...
    }

最后,使用 Composer 安装扩展包

$ php composer.phar update markup/addressing-bundle

使用方法

简单使用示例

    $renderer = $this->get('markup_addressing.address.renderer');
    $address = new MyAddressAdapter($myAddress); //MyAddressAdapter here wraps a different address definition and makes it implement Markup\Addressing\AddressInterface
    echo $renderer->render($address, ['format' => 'plaintext']);

这将输出一个地址,根据国家使用纯文本正确格式化。

许可协议

在 MIT 许可协议下发布。请参阅 LICENSE 文件。

Build Status