Package Data | |
---|---|
Maintainer Username: | PhpAnonymous |
Maintainer Contact: | gm@phpanonymous.com (PHP ANONYMOUS) |
Package Create Date: | 2016-09-19 |
Package Last Update: | 2018-04-24 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-14 15:08:49 |
Package Statistics | |
---|---|
Total Downloads: | 9,312 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 6 |
Total Watchers: | 3 |
Total Forks: | 3 |
Total Open Issues: | 3 |
A simple package to Get Yahoo weather by using YQL created By PHPAnonymous
Using composer: composer require yahooweather/weather:dev-master
Add the Provider class to your config/app.php
file
YahooWeather\Weather\PHPAnonymousYahooWeather::class,
'YahooWeather' => YahooWeather\Weather\AnonyControllerYahooWeather::class,
use YahooWeather;
YahooWeather
Class. It takes two parameters, a country and a language. YahooWeather::Country('egypt','ar');
The result is returned as a JSON array:
{"high":"30","low":"18","image":"http:\/\/l.yimg.com\/a\/i\/us\/we\/52\/32.gif","name":"egypt","description":"\n\nCurrent Conditions:\nSunny\n\n\nForecast:\n Mon - Mostly Sunny. High: 30Low: 18\n Tue - Sunny. High: 32Low: 18\n Wed - Partly Cloudy. High: 33Low: 18\n Thu - Partly Cloudy. High: 33Low: 19\n Fri - Mostly Sunny. High: 33Low: 20\n\n\n\n\n\n\n\n"}
// high | العظمي
// low | الصغري
// name | country name / اسم الدولة
// image | image status frequency | حالة الطقس بالصورة
// description | other details | تفاصيل اخري
$weather = YahooWeather::Country('egypt','ar');
echo $weather['high'];
echo $weather['low'];
echo $weather['image'];
echo $weather['name'];
echo $weather['description'];
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use YahooWeather;
class WeatherController extends Controller
{
public function get_weather(){
$weather = YahooWeather::Country('lebanon','ar');
var_dump($weather);
}
}
For more advanced queries, you can use the custom query function:
$weather = YahooWeather::YQL('Your Query Here');
dd($weather);
Check the Yahoo YQL Console for more information on YQL queries: https://developer.yahoo.com/yql/console
That's it :)
Enjoy