fatindeed/seniverse-api

PHP Client for Seniverse API

1.0.0 2019-05-17 06:33 UTC

This package is auto-updated.

Last update: 2024-12-17 20:03:08 UTC


README

PHP Version Packagist Version Downloads License Build Status

Seniverse 账号注册

注册页面

开始

composer require fatindeed/seniverse-api

配置环境变量(如.env):

SENIVERSE_UID="your public key"
SENIVERSE_KEY="your private key"

或者也可以在使用时直接传入:

$weather = new SeniverseApi\Weather([
    'uid' => 'your public key',
    'key' => 'your private key'
]);

查看你的API密钥

城市搜索

$location = new SeniverseApi\Location;
$result = $location->search('WTW3SJ5ZBJUY');

天气实况

$weather = new SeniverseApi\Weather;
$result = $weather->now('WTW3SJ5ZBJUY');

逐日天气预报

$weather = new SeniverseApi\Weather;
$result = $weather->daily('WTW3SJ5ZBJUY');

生活指数

$life = new SeniverseApi\Life;
$result = $life->suggestion('WTW3SJ5ZBJUY');

FAQs

  1. 免费用户可以调用哪些数据

    • 国内 370 个地级市
    • 天气实况(2 项)
    • 3 天天气预报
    • 生活指数(基础 6 项)
  2. 城市列表

References