puwnz/google-maps-serializer-bundle

序列化GoogleMapsBundle的响应

1.0.0 2020-11-06 09:52 UTC

This package is auto-updated.

Last update: 2024-09-18 05:55:49 UTC


README

概览

Google Maps Serializer Bundle项目为您的Symfony 4+和PHP 7.3+项目提供Google Maps Bundles响应的序列化。目前,这个库只启用了geocode,因为我的需求只在这里,但您可以打开问题来推动您的需求。

安装

要安装这个库,您只需使用composer

composer require puwnz/google-maps-serializer-bundle

集成

Bundle注册

<?php
// config/bundles.php

return [
    Puwnz\GoogleMapsSerializerBundle\GoogleMapsSerializerBundle::class => ['all' => true]
];

示例

要在您的symfony项目中使用此包,您可以使用以下示例

<?php

namespace App\Controller;

use Puwnz\GoogleMapsBundle\Service\GeocodeService;
use Symfony\Component\HttpFoundation\JsonResponse;

class FooController extends AbstractController {
    public function getGeocodeResult(string $address, GeocodeService $geocodeService) : JsonResponse
    {
        return $this->json($geocodeService->call($address));
    }
}

测试

该捆绑包由PHPUnit完全单元测试,代码覆盖率接近100%

贡献

我们热爱贡献者!这是一个开源项目。如果您想贡献,请随时提出PR!

许可

Google Map Lib处于MIT许可下。有关完整的版权和许可信息,请阅读随源代码一起分发的LICENSE文件。