All Projects → dmitry-ivanov → Dark Sky Api

dmitry-ivanov / Dark Sky Api

Licence: mit
PHP Library for the Dark Sky API.

Projects that are alternatives of or similar to Dark Sky Api

Forecastr
A simple, asynchronous Objective-C wrapper for the Forecast.io API
Stars: ✭ 143 (+104.29%)
Mutual labels:  api, forecast, weather
Response Xml
The missing XML support for Laravel's Response class.
Stars: ✭ 56 (-20%)
Mutual labels:  api, laravel, laravel-package
Bigbluebutton
Package that provides easily communicate between bigbluebutton server and laravel framework
Stars: ✭ 85 (+21.43%)
Mutual labels:  api, laravel, laravel-package
Laravel Weather
🌤️ A wrapper around Open Weather Map API (Current weather)
Stars: ✭ 36 (-48.57%)
Mutual labels:  weather, laravel, laravel-package
Laravel Api Explorer
API explorer for laravel applications
Stars: ✭ 138 (+97.14%)
Mutual labels:  api, laravel, laravel-package
Laravel Compass
A REST client inside your Laravel app
Stars: ✭ 1,002 (+1331.43%)
Mutual labels:  api, laravel, laravel-package
Lumen Api Starter
Quickstarter for Lumen
Stars: ✭ 54 (-22.86%)
Mutual labels:  api, laravel
Weather
A module for obtaining weather information
Stars: ✭ 54 (-22.86%)
Mutual labels:  forecast, weather
Framework
An eCommerce administration built with Laravel 7 for create and manage online shop with multi-vendor.
Stars: ✭ 56 (-20%)
Mutual labels:  laravel, laravel-package
Shopping Cart
An easy-to-use shopping cart for Laravel
Stars: ✭ 57 (-18.57%)
Mutual labels:  laravel, laravel-package
Laravel admin api
基于laravel5.5开发的基础后台管理脚手架, RBAC权限控制; 接口基于dingo/api和tymon/jwt, 可在此基础上完成你的laravel项目
Stars: ✭ 59 (-15.71%)
Mutual labels:  api, laravel
Laravel Opcache
Laravel Package for OPcache
Stars: ✭ 1,116 (+1494.29%)
Mutual labels:  laravel, laravel-package
Larapi
💛 Modern API development in Laravel.
Stars: ✭ 54 (-22.86%)
Mutual labels:  laravel, laravel-package
Cj Google Geocoder
Stars: ✭ 49 (-30%)
Mutual labels:  laravel, laravel-package
Weacast
Weacast demo application
Stars: ✭ 55 (-21.43%)
Mutual labels:  forecast, weather
Laravel Heartbeat
Periodically schedule a job to send a heartbeat to a monitoring system.
Stars: ✭ 49 (-30%)
Mutual labels:  laravel, laravel-package
Laravel Async
Package provide simple way to run code asynchronously for your Laravel application.
Stars: ✭ 49 (-30%)
Mutual labels:  laravel, laravel-package
Backup
MySQL Database backup package for Laravel
Stars: ✭ 66 (-5.71%)
Mutual labels:  laravel, laravel-package
Laravel Api Health
Monitor first and third-party services and get notified when something goes wrong!
Stars: ✭ 65 (-7.14%)
Mutual labels:  laravel, laravel-package
Laravel Remember Uploads
Laravel Middleware and helper for remembering file uploads during validation redirects
Stars: ✭ 67 (-4.29%)
Mutual labels:  laravel, laravel-package

PHP Library for the Dark Sky API

Dark Sky API

Become a Patron

StyleCI Build Status Coverage Status

Packagist Version Packagist Stars Packagist Downloads Packagist License

PHP Library for the Dark Sky API.

Dark Sky API - Demo

Usage

  1. Install the package via Composer:

    composer require dmitry-ivanov/dark-sky-api
    
  2. Use the DmitryIvanov\DarkSkyApi\DarkSkyApi class:

    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!

  1. Publish the config:

    php artisan vendor:publish --provider="DmitryIvanov\DarkSkyApi\Adapters\Laravel\DarkSkyApiServiceProvider"
    
  2. Set your secret key in the .env file:

    DARK_SKY_KEY="Your-Secret-Key"
    
  3. Use the DarkSkyApi facade:

    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

Laravel Idea

License

Dark Sky API is open-sourced software licensed under the MIT license.

Support on Patreon

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].