定制 flibidi67/open-meteo-geocoding 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

flibidi67/open-meteo-geocoding

最新稳定版本:1.0.1

Composer 安装命令:

composer require flibidi67/open-meteo-geocoding

包简介

PHP SDK to use Open Meteo Geocoding API

README 文档

README

Latest Version on Packagist Total Downloads

Open-Meteo collaborates with National Weather Services providing Open Data with 11 to 2 km resolution. Our high performance APIs select the best weather model for your location and provide data as a simple JSON API.

APIs are free without any API key for open-source developers and non-commercial use. You can embed them directly into your app.

Official documentation is available here.

Installation

You can install the package via composer:

composer require flibidi67/open-meteo-geocoding

Usage

Native PHP

require_once('/path/to/vendor/flibidi67/open-meteo-geocoding/src/Service/GeocodingService');
use Flibidi67\OpenMeteoGeocoding\Service\GeocodingService;

$service = new GeocodingService();

Symfony

If you want to use DependencyInjection, you have to add this to your config/services.yaml:

services:
    # your other configuration
  
    Flibidi67\OpenMeteoGeocoding\Service\GeocodingService:
        autowire: true

Then you can use it like that :

use Flibidi67\OpenMeteoGeocoding\Service\GeocodingService;
public function myFunction(GeocodingService $geocodingService) {
    $geocodingService->get('Stras');
}

// or
public function myFunction2() {
    $geocodingService = new GeocodingService();
    $geocodingService->get('Stras');
}

Available service's methods

Here are all the available service's methods :

  • setLanguage, to set the language, accepted values are en, de, fr, es, it, pt, ru, tr and hi, by default en.
  • setFormat, to set the format, to be honest, useless because only json is currently supported
  • setCount, to set how much results do you want to retrieve (min 1, max 100), by default 10.
  • setName, to set the search field, must be at least 3 characters.
  • setCountryCode, to set the country code field.
  • setCurlCheckSSLCertificate, to disable curl SSL verification (not recommended, but just in case), by default true
  • get, retrieve the results, you can give the search field when calling this method, see example above

If you are manually instanciate the service, you can give an array of settings to avoid you using the set methods, like this :

    $geocodingService = new GeocodingService(
        'language' => 'fr',
        'name' => 'Stra',
        'format' => 'json',
        'count' => 42,
        'countryCode' => 'FR',
        'curlCheckSSLCertificate' => false
    );
    // or just some of them
    $geocodingService = new GeocodingService(
        'language' => 'fr',
        'count' => 42
    );

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固