Courses

Laravel HTTP Client and 3rd-Party APIs

OpenWeatherMap: Public API with HTTP GET

You're reading a FREE PREVIEW of a PREMIUM course.

Video Version of the Lesson

[Only for premium members]

Link to the repository

[Only for premium members]

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 7 video+text lessons of this course? (50 min)

You also get:

  • 83 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord