PHPackages                             stuarttodd-dev/weather-forecast-app - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. stuarttodd-dev/weather-forecast-app

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

stuarttodd-dev/weather-forecast-app
===================================

A package for retrieving weather forecasts based on IP addresses and timestamps.

013PHP

Since Sep 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/stuarttodd-dev/WeatherForecastAPI)[ Packagist](https://packagist.org/packages/stuarttodd-dev/weather-forecast-app)[ RSS](/packages/stuarttodd-dev-weather-forecast-app/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Weather Forecast Library
============================

[](#php-weather-forecast-library)

The PHP Weather Forecast Library is a PHP package that provides weather forecast information based on geolocation data. It uses external services to retrieve geolocation and weather forecast data.

Installation
------------

[](#installation)

Get an API Key from Open Weather API. Visit  for more information.

You can install this library via Composer. Run the following command:

```
composer require stuarttodd-dev/weather-forecast-app
```

Configure composer.json
-----------------------

[](#configure-composerjson)

Package is still under development.

```
"minimum-stability": "dev",

```

Static Usage
------------

[](#static-usage)

```

use StuartToddDev\WeatherForecast\Services\WeatherForecast;

$weatherForecast = WeatherForecast::create('your-ip-address', 'your-open-weather-api-key');

$weatherForecast->getIpAddress(); // returns ip
$weatherForecast->getGeolocation(); // e.g {"status":"success","country":"United Kingdom","countryCode":"GB","region":"ENG","regionName":"England","city":"Stockton-on-Tees","zip":"TS18","lat":54.5579,"lon":-1.328,"timezone":"Europe/London","isp":"Virgin Media","org":"","as":"AS5089 Virgin Media Limited","query":"86.22.157.53"}
$weatherForecast->getForecast(); // Json string from open weather API (see https://openweathermap.org/api/one-call-3)

```

Inject API Services
-------------------

[](#inject-api-services)

```
use StuartToddDev\WeatherForecast\Services\WeatherForecast;
use StuartToddDev\WeatherForecast\Services\GeolocationIPAPI;
use StuartToddDev\WeatherForecast\Services\OpenWeatherAPI;

// Initialize the geolocation and weather forecast services
$geolocationAPI = new GeolocationIPAPI(new Client()); // first param is Guzzle client
$forecastAPI = new OpenWeatherAPI(new Client()'); // first param is Guzzle client

You can inject different API services (or adjust them) as long as they implement the relevant contracts (noted below).

// Initialize the WeatherForecast class
$weatherForecast = new WeatherForecast('your-ip-address', 'your-open-weather-api-key', $geolocationAPI, $forecastAPI);
$weatherForecast->getIpAddress(); // returns ip
$weatherForecast->getGeolocation(); // e.g {"status":"success","country":"United Kingdom","countryCode":"GB","region":"ENG","regionName":"England","city":"Stockton-on-Tees","zip":"TS18","lat":54.5579,"lon":-1.328,"timezone":"Europe/London","isp":"Virgin Media","org":"","as":"AS5089 Virgin Media Limited","query":"86.22.157.53"}
$weatherForecast->getForecast(); // Json string from open weather API (see https://openweathermap.org/api/one-call-3)

```

ForecastContract
----------------

[](#forecastcontract)

Used by OpenWeatherAPI

```
    public function setLon(string $lon): self;
    public function getLon(): string;
    public function setLat(string $lat): self;
    public function getLat(): string;
    public function setApiKey(string $apiKey): self;
    public function getForecast(): ?string;

```

GeolocationContract
-------------------

[](#geolocationcontract)

Used by GeolocationIPAPI

```
interface GeolocationContract
{
    public function setIPAddress(string $ipAddress): self;
    public function getIPAddress(): ?string;
    public function getGeoLocation(): ?string;
}

```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d7514db87ed49ccef24aee6af3c509527472bc70b9be35c02c081996436fb77?d=identicon)[stuarttodd-dev](/maintainers/stuarttodd-dev)

---

Top Contributors

[![stuarttodd-dev](https://avatars.githubusercontent.com/u/54860041?v=4)](https://github.com/stuarttodd-dev "stuarttodd-dev (13 commits)")

### Embed Badge

![Health badge](/badges/stuarttodd-dev-weather-forecast-app/health.svg)

```
[![Health](https://phpackages.com/badges/stuarttodd-dev-weather-forecast-app/health.svg)](https://phpackages.com/packages/stuarttodd-dev-weather-forecast-app)
```

###  Alternatives

[responsiv/currency-plugin

Currency plugin for October CMS

171.3k1](/packages/responsiv-currency-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
