定制 ajur-media/openweathermap-data-parser 二次开发

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

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

ajur-media/openweathermap-data-parser

最新稳定版本:1.0.0

Composer 安装命令:

composer require ajur-media/openweathermap-data-parser

包简介

A PHP class to parse weather data from OpenWeatherMap.org. This library tries to normalise and abstract the data and remove inconsistencies

README 文档

README

A PHP class to retrieve and parse weather data from OpenWeatherMap.org.

This library aims to normalise the provided data and remove some inconsistencies. This library is neither maintained by OpenWeatherMap nor their official PHP API.

Installation

This library can be found on Packagist. The recommended way to install and use it is through Composer.

composer require ajur-media/openweathermap-data-parser

Example call

<?php
use AJUR\OpenWeatherMap;
use AJUR\OpenWeatherMap\Exception as OWMException;

// Must point to composer's autoload file.
require 'vendor/autoload.php';

// Language of data (try your own language here!):
$lang = 'ru';

// Units (can be 'metric' or 'imperial' [default]):
$units = 'metric';

// Create OpenWeatherMap object. 
// Don't use caching (take a look into Examples/Cache.php to see how it works).
$owm = new OpenWeatherMap('YOUR-API-KEY');

try {
    $weather = $owm->getWeather('Berlin', $units, $lang);
} catch(OWMException $e) {
    echo 'OpenWeatherMap exception: ' . $e->getMessage() . ' (Code ' . $e->getCode() . ').';
} catch(\Exception $e) {
    echo 'General exception: ' . $e->getMessage() . ' (Code ' . $e->getCode() . ').';
}

echo $weather->temperature;

License

MIT — Please see the LICENSE file distributed with this source code for further information regarding copyright and licensing.

Please check out the following official links to read about the terms, pricing and license of OpenWeatherMap before using the service:

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-24