Skip to content

deanhouseholder/simple-weather-app

Repository files navigation

Simple Weather App

Made for eSalon by Dean Householder on 23 Mar 2021 Updated on 19 Dec 2022 to use OpenWeather API instead of MetaWeather Hosted on https://weather.deanhouseholder.com/

Original requirements were to build a simple weather app using a modern framework which fetches the latitude/longitude for the user's IP from the freegeoip.app API. Then to looks up the weather from the metaweather.com API. Then displays it on a clean web interface. While this could've been a javascript-based app entirely, the focus was on PHP backend skills.

2023 - MetaWeather is now defunct so I re-engineered it to use the OpenWeatherMap.org API instead.

Files added/modified include:

File path Description
app/Classes/FreeGeoIp.php FreeGeoIp class to communicate with freegeoip.app API
app/Classes/Helpers.php Helpers class to provide one-off functions
app/Classes/OpenWeather.php OpenWeather class to communicate with openweathermap.org API
app/Controllers/WeatherController.php Main page controller to tie together to api logic
app/config/app.php Defined configuration variables in the App config
public/img/* Uploaded various images
public/favicon.ico Added a weather favicon
resources/sass/app.scss Added custom styles in SCSS
resources/views/home.blade.php Main view for displaying weather data
resources/views/error.blade.php Error view for when city is not found
resources/views/snippets/footer.blade.php Site Footer
resources/views/snippets/header.blade.php Site Header
routes/web.php Added the main route

Implemented in Laravel/Bootstrap, as requested. Used https://freegeoip.app/ and https://www.metaweather.com/api/ as requested. Updated later to use https://openweathermap.org/.

See inline comments for walk-through.

I completed this project in about 6 hours. If I had more time, I would add tests, scrub user input, add a solution to missing cities, and improve the icons.

About

Simple Weather App made for eSalon by Dean Householder on 23 Mar 2021

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published