2gis/api-symfony-bundle

2GIS Web API 的 Symfony Bundle

安装: 106

依赖项: 0

建议者: 0

安全: 0

星级: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

dev-master 2015-01-25 12:35 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:41:31 UTC


README

Build Status Scrutinizer Code Quality

将 2GIS API 集成到基于 Symfony2 的项目的 Bundle。提供者包装 2gis/api-client 组件。

安装

#### 修改 composer.json 扩展

{
    "require": {
        "2gis/api-symfony-bundle": "dev-master"
    }
}

安装包

在项目目录中运行 composer update

注册 Bundle

// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new DGis\Bundle\ApiBundle\DGisApiBundle(),
        );
        // ...
    }
    // ...
}

添加配置

#app/config.yml
# ...
d_gis_api:
    key: %dgis_key%

定义参数

#app/parameters.yml
parameters:
    # ...
    dgis_key: test

使用

d_gis_api 参数

  • key - 访问 API 的唯一 密钥,必填参数。
  • class_map - API 实体与应用程序类的映射数组,例如 Address: \MyCustomAddress。默认使用客户端库中的类。

服务

许可证