ecce / laravel-weather
Laravel Weather Package
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^8.2.1
- stuarttodd-dev/weather-forecast-app: dev-main
This package is auto-updated.
Last update: 2024-08-24 12:23:16 UTC
README
The Laravel Weather Package is a powerful tool for integrating weather forecast data into your Laravel application. It allows you to fetch weather data for a given IP address, display geo-location information, and present a 5-day weather forecast along with a map for visualization.
Installation
To get started with the Laravel Weather Package, follow these steps:
- Configure composer.json
"minimum-stability": "dev",
- Install the package via Composer:
composer require ecce/laravel-weather
- Publish the package configuration and views:
php artisan vendor:publish --tag=laravel-weather-config
php artisan vendor:publish --tag=laravel-weather-assets
php artisan vendor:publish --tag=laravel-weather-views
- Configure your API key in the config/laravel-weather.php file. Visit - https://openweathermap.org/api
return [
'api_key' => env('OPEN_WEATHER_API_KEY', ''),
];
- Fetch data option
use Ecce\LaravelWeather\Facades\LaravelWeather;
// Example: Fetch weather data for an IP address
$ipAddress = '123.45.67.89';
$weatherData = LaravelWeather::getDailyForecast($ipAddress);
$geoLocation = $weatherData['geoLocation'];
$forecast = $weatherData['forecast'];
- Visit URL Visit /weather-forecasts within your Laravel app