dashcode / weather
AccuWeather API Data
1.1.0
2023-12-01 14:12 UTC
Requires
- php: >=7.4.0
- ext-json: *
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-30 01:43:06 UTC
README
This is a PHP Client for connecting with Accuweather APIs allow you to easy integration with APIs
Installation
composer require dashcode/weather
Set Environment Variables
You can set environment variables like key and language settings via .env
file
ACCU_WEATHER_KEY=your key
ACCU_WEATHER_LOCALE=en-us ( default )
Alternatively You can also pass the key and language settings directly into Weather Class
new Weather("your accuweather key", "language");
How To Use APIs
after setting up the .env variable via .env
file or directly injected into class
- Make a weather Class object of
DashCode\Weather
$accuWeatherApp = new Weather();
- Select the Api Class
1. Alert API
$response = $accuWeatherApp->Alerts();
2. Current Condition API
$response = $accuWeatherApp->CurrentConditions();
3. Forecast API
$response = $accuWeatherApp->Forecast();
4. Imagery API
$response = $accuWeatherApp->Imagery();
5. Indices API
$response = $accuWeatherApp->Indices();
6. Locations API
$response = $accuWeatherApp->Locations();
7. MinuteCast API
$response = $accuWeatherApp->MinuteCast();
8. Translation API
$response = $accuWeatherApp->Translations();
9. Tropical API
$response = $accuWeatherApp->Tropical();
10. Weather Alart API
$response = $accuWeatherApp->WeatherAlarms();
- Select API endpoint and add required paramaters to method for
Alert
Api we can do like this
$accuWeatherApp = new Weather();
$alertApis = $accuWeatherApp->Alerts();
$apiResponse = $alertApis->location("location key", true );
Please refer to the documentation of accuweather or package method for required params
Tech Stack
Server: PHP