Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

OpenWeatherMap: Public API with HTTP GET

Premium
8:06

Let's start our Laravel HTTP Client journey with a simple real-world example: building a weather widget that displays current London weather information from OpenWeatherMap API.

Weather Widget Preview


What You'll Learn

By the end of this lesson, you will learn how to:

  • Organize API request logic in dedicated Service classes
  • Use Http::get() with query parameters
  • Check success and parse JSON result
  • Extract JSON data safely and process missing values
  • Manage errors when APIs fail
  • Store API keys in config and environment files

Structure of OpenWeatherMap API

You need to check the documentation for every external third-party API, which, if you're lucky, often leads to dedicated PHP/Laravel packages.

However, in this course, I want to focus on APIs without packages, so you will adopt the skill to use any API in the future.

In the case of OpenWeatherMap, the main API call information for the current weather looks like this:

So, this is a straightforward case: just an API call with...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 46 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.