承接 iidestiny/weather 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

iidestiny/weather

Composer 安装命令:

composer require iidestiny/weather

包简介

Weather acquisition module

README 文档

README

天气查询组件

Build Status StyleCI build status

安装

$ composer require iidestiny/weather -vvv

配置

百度开放平台后台获取 AK

使用

use IiDestiny\Weather\Weather;

$ak = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';

$weather = new Weather($ak);

// 返回数组格式
$response = $weather->getWeather('深圳');

// 批量获取
$response = $weather->getWeather('深圳|北京');

// 返回 XML 格式
$response = $weather->getWeather('深圳', 'xml');

// 按坐标获取
$response = $weather->getWeather('116.30,39.98', 'json');

// 批量坐标获取
$response = $weather->getWeather('116.43,40.75|120.22,43,33', 'json');

// 自定义坐标格式(coord_type)
$response = $weather->getWeather('116.306411,39.981839', 'json', 'bd09ll');

参数说明

array | string   getWeather(string $location, string $format = 'json', string $coordType = null)
  1. $location 地点,中文或者坐标地址,多个用斗角逗号隔开
  2. $format 返回格式, json(默认)/xml, json 将会返回数组格式,xml 返回字符串格式。
  3. $coordType 坐标格式,允许的值为bd09ll、bd09mc、gcj02、wgs84,默认为 gcj02 经纬度坐标。
  4. 详情说明请参考官方:http://lbsyun.baidu.com/index.php?title=car/api/weather

Laravel 中使用

.env 配置文件中添加配置 (BAIDU_SN) 可选

BAIDU_AK=xxxxx
BAIDU_SN=xxxxx

然后方法注入

function index(\IiDestiny\Weather\Weather $weather)
{
    return $weather->getWeather('北京');
}

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-08-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固