Http Client Course OpenWeatherMap
#About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
#Learning Laravel
Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
You may also try the Laravel Bootcamp, where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, Laracasts can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
#Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Partners program.
#Premium Partners
#Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
#Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
#Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.
#License
The Laravel framework is open-sourced software licensed under the MIT license.
#Laravel Weather App
A simple Laravel application that displays the current weather for London, UK using the OpenWeatherMap API.
#Features
- Real-time weather data for London
- Beautiful, responsive UI with Tailwind CSS
- Dark mode support
- Comprehensive weather information including:
- Temperature and "feels like" temperature
- Weather description with icons
- Humidity and atmospheric pressure
- Wind speed and direction
- Sunrise and sunset times
- Visibility and cloud cover
- Error handling for API failures
#Setup Instructions
-
Clone the repository:
git clone <repository-url> cd openweathermap
-
Install dependencies:
composer install npm install
-
Environment configuration:
cp .env.example .env php artisan key:generate
-
Get OpenWeatherMap API Key:
- Visit OpenWeatherMap
- Create a free account
- Generate an API key
-
Configure environment variables: Add your API key to the
.envfile:OPENWEATHER_API_KEY=your_actual_api_key_here OPENWEATHER_BASE_URL=https://api.openweathermap.org/data/2.5
-
Build assets:
npm run build # or for development npm run dev -
Serve the application:
php artisan serve
The application will be available at
http://localhost:8000
#Project Structure
app/Services/WeatherService.php- Handles OpenWeatherMap API communicationapp/Http/Controllers/HomeController.php- Homepage controllerconfig/services.php- API configurationresources/views/welcome.blade.php- Weather display viewroutes/web.php- Application routes
#API Error Handling
The application includes comprehensive error handling:
- Invalid API key (401 Unauthorized)
- Invalid coordinates (400 Bad Request)
- Rate limit exceeded (429 Too Many Requests)
- Service temporarily unavailable (5xx errors)
- Network timeouts and connection issues
When the API is unavailable, the application displays helpful error messages and setup instructions.
#Technologies Used
- Laravel 11+ - PHP framework
- Tailwind CSS - Styling framework
- OpenWeatherMap API - Weather data provider
- Vite - Frontend build tool
#License
This project is open-sourced software licensed under the MIT license.