ecce/laravel-weather
Composer 安装命令:
composer require ecce/laravel-weather
包简介
Laravel Weather Package
README 文档
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
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-21