定制 matthewhallcom/pirate-weather-php 二次开发

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

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

matthewhallcom/pirate-weather-php

最新稳定版本:v1.1.0

Composer 安装命令:

composer require matthewhallcom/pirate-weather-php

包简介

PHP Library for the Pirate Weather API.

README 文档

README

PHP Library for the Pirate Weather API.

This is a fork of the dmitry-ivanov/dark-sky-api package.

Usage

  1. Install the package via Composer:

    composer require matthewhallcom/pirate-weather-php
    
  2. Use the MatthewHallCom\PirateWeather\PirateWeather class:

    use MatthewHallCom\PirateWeather\PirateWeather;
    
    $forecast = (new PirateWeather('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 PirateWeather('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 PirateWeather('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!

  1. Publish the config:

    php artisan vendor:publish --provider="MatthewHallCom\PirateWeather\Adapters\Laravel\PirateWeatherServiceProvider"
    
  2. Set your secret key in the .env file:

    PIRATE_WEATHER_KEY="Your-Secret-Key"
    
  3. Use the PirateWeather facade:

    use PirateWeather;
    
    $forecast = PirateWeather::location(46.482, 30.723)
        ->forecast('daily');
    
    echo $forecast->daily()->summary();
    

License

Pirate Weather PHP is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固