mapslat/mapslat-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mapslat/mapslat-php

Composer 安装命令:

composer require mapslat/mapslat-php

包简介

Package provides the ability to interact with the Maps.lat API.

README 文档

README

This is a Maps.lat APi client written in PHP. This package contains methods for interacting with APi. Below are some usage examples. You can find more information about the APi in the Maps.lat documentation.

Installation

You must use Composer to install this package. You can install Composer using the command.

curl -sS https://getcomposer.org/installer | php

Package supports PHP version 8.0 and higher. To install this package, run the following command.

composer require mapslat/mapslat-php

Usage

The examples below assume that you are using Composer autoloader in your application. The autoloader is called by the following code.

require 'vendor/autoload.php';
use Mapslat\Mapslat;

Request structure

Create an instance of the class and pass one or two parameters. The first parameter is your API key. The second optional parameter is the $throw flag, which determines whether to throw exceptions on errors (defaults to true).

$mapslat = new Mapslat($apiKey);

The request is built from an array or from a json string that you pass to the method you are calling.

// array as input data
$search = $mapslat->search([
	'query' => 'chicago',
	'limit' => 1
]);

// or json as input data
$search = $mapslat->search('{
	"query": "london",
	"limit": 1
}');

Response structure

The response is returned as an instance of Symfony\Contracts\HttpClient\ResponseInterface. You can call interface methods that return headers, data, http status, etc. See the Symfony HttpClient documentation for more details.

// get response data
$isoline = $mapslat->isoline('{
	"lon": 13.37467722463873,
	"lat": 52.55351817997314,
	"costing": "auto",
	"polygons": true,
	"time": 5
}')->toArray();

// get status code
$statusCode = $mapslat->search([
	'query' => 'chicago',
	'limit' => 1
])->getStatusCode();

// get response headers
$reverse = $mapslat->reverse([
	'lon' => -73.99672895945677,
	'lat' => 40.72494710252593
]);
$headers = $reverse->getHeaders();

// get raw response
$rawResponse = $mapslat->search([
	'query' => 'miami beach',
	'limit' => 3
])->getContent();

Requests to API

For each Maps.lat API endpoint, there is a method for interactions.

Geocoding

// forward geocoding
$data = $mapslat->search($payload)->toArray();

// reverse geocoding
$data = $mapslat->reverse($payload)->toArray();

// geocoding lookup
$data = $mapslat->lookup($payload)->toArray();

Address autocomplete

$data = $mapslat->autocomplete($payload)->toArray();

Routing

// routing
$data = $mapslat->route($payload)->toArray();

// optimal route
$data = $mapslat->optimal($payload)->toArray();

//routing locate
$data = $mapslat->locate($payload)->toArray();

Isoline

$data = $mapslat->isoline($payload)->toArray();

Matrix

$data = $mapslat->matrix($payload)->toArray();

Map matching

// matching routes
$data = $mapslat->match($payload)->toArray();

// matching attributes
$data = $mapslat->attributes($payload)->toArray();

Contribute

This package is Open Source, published under the MIT license. You can participate in its development and improvement.

We will be glad if you take part in the work on this package. Create issues if you find bugs, develop your own and review other people's pull requests, respond to other people's issues, and so on.

Support and feedback

Be sure to visit the Maps.lat documentation for additional information about our API.

If you find a bug, please submit the issue in Github directly.

If you need further assistance email us at support@maps.lat.

mapslat/mapslat-php 适用场景与选型建议

mapslat/mapslat-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 mapslat/mapslat-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mapslat/mapslat-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 mapslat/mapslat-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-30