dmitry-ivanov/dark-sky-api
最新稳定版本:1.4.0
Composer 安装命令:
composer require dmitry-ivanov/dark-sky-api
包简介
PHP Library for the Dark Sky API.
关键字:
README 文档
README
Dark Sky API
PHP Library for the Dark Sky API.
Usage
-
Install the package via Composer:
composer require dmitry-ivanov/dark-sky-api
-
Use the
DmitryIvanov\DarkSkyApi\DarkSkyApiclass:use DmitryIvanov\DarkSkyApi\DarkSkyApi; $forecast = (new DarkSkyApi('secret-key')) ->location(46.482, 30.723) ->forecast('daily'); echo $forecast->daily()->summary();
Time Machine Requests
Sometimes it might be useful to get weather for the specified date:
$timeMachine = (new DarkSkyApi('secret-key')) ->location(46.482, 30.723) ->timeMachine('2020-01-01', 'daily'); echo $timeMachine->daily()->summary();
You can also get weather for multiple dates:
$timeMachine = (new DarkSkyApi('secret-key')) ->location(46.482, 30.723) ->timeMachine(['2020-01-01', '2020-01-02', '2020-01-03'], 'daily'); echo $timeMachine['2020-01-02']->daily()->summary();
Usage in Laravel
If you're using Laravel <5.5, you have to register service provider and alias by yourself!
-
Publish the config:
php artisan vendor:publish --provider="DmitryIvanov\DarkSkyApi\Adapters\Laravel\DarkSkyApiServiceProvider" -
Set your secret key in the
.envfile:DARK_SKY_KEY="Your-Secret-Key"
-
Use the
DarkSkyApifacade:use DarkSkyApi; $forecast = DarkSkyApi::location(46.482, 30.723) ->forecast('daily'); echo $forecast->daily()->summary();
Learn more
You can find more information in my article.
Sponsors
License
Dark Sky API is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 41.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 70
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-10





