PHPackages                             uberboom/forecast - 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. uberboom/forecast

ActiveLibrary

uberboom/forecast
=================

314PHP

Since May 2Pushed 12y ago1 watchersCompare

[ Source](https://github.com/uberboom/forecast-php)[ Packagist](https://packagist.org/packages/uberboom/forecast)[ RSS](/packages/uberboom-forecast/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

forecast-php
============

[](#forecast-php)

Forecast.io API for PHP

- Framework agnostic
- Built in Laravel support
- Cache support to reduce API calls
- Provide your own cache store and http client, if required

Using Forecast with Laravel 4
-----------------------------

[](#using-forecast-with-laravel-4)

### App Configuration

[](#app-configuration)

You can register the ForecastServiceProvider to automatically use the Laravel built in cache functionality.

To do so, update the `providers` array in your `app/config/app.php`:

```
'providers' => array(
	// ...
	'Uberboom\Forecast\ForecastServiceProvider',
),
```

Next, update the class aliases in the `aliases` array in your `app/config/app.php`:

```
'providers' => array(
	// ...
	'Forecast' => 'Uberboom\Forecast\Facades\Forecast',
),
```

### Configuration

[](#configuration)

First, publish the configuration from the package:

```
php artisan config:publish uberboom/forecast
```

#### API Key

[](#api-key)

Get an API key at [Forecast for Developers](https://developer.forecast.io) and add the API key to the `app/config/packages/uberboom/forecast/config.php` file:

```
'api_key' => 'your-api-key-from-developer.forecast.io',
```

#### Configuring the HTTP Client

[](#configuring-the-http-client)

The package includes two difference HTTP client implementations: One is using the [PHP Curl extension](http://www.php.net/manual/book.curl.php), the other one relies on `file_get_contents()`, so make sure that either the Curl extension is loaded or [`allow_url_fopen`](http://www.php.net/manual/filesystem.configuration.php#ini.allow-url-fopen) is enabled in your php.ini file.

```
'httpclient' => 'curl|file',
```

### Retrieving the Weather Forecast

[](#retrieving-the-weather-forecast)

The package provides some Laravel Facade magic, so fetching the weather forecast is a piece of cake:

```
$weather = \Forecast::getWeatherByLocation($latitude, $longitude);
```

If you need to change the units, you can set the units used in the response by using the method `setUnits()`:

```
$weather = \Forecast::setUnits(\Uberboom\Forecast\Forecast::UNITS_SI)->getWeatherByLocation($latitude, $longitude);
```

Not Using Laravel?
------------------

[](#not-using-laravel)

### Manual Configuration

[](#manual-configuration)

If you are not using Laravel, you have to set the API key manually:

```
$forecastApiKey = 'your-api-key-from-developer.forecast.io';
$forecast = new \Uberboom\Forecast\Forecast();
$forecast->setApiKey($forecastApiKey);
```

### Setting the HTTP Client

[](#setting-the-http-client)

The package includes two difference HTTP client implementations: One is using the [PHP Curl extension](http://www.php.net/manual/book.curl.php), the other one relies on `file_get_contents`, so make sure that either the Curl extension is loaded or [`allow_url_fopen`](http://www.php.net/manual/filesystem.configuration.php#ini.allow-url-fopen) is enabled in your php.ini file.

```
$forecast->setHttpClientWrapper(new \Uberboom\Forecast\HttpClient\Curl());
$forecast->setHttpClientWrapper(new \Uberboom\Forecast\HttpClient\File());
```

### Cache

[](#cache)

Currently, the package only includes an cache store implementation for the Laravel framework. If you want to use the package’s cache functionality, you need to build and inject your own cache store class, which has to implement the `\Uberboom\Forecast\CacheStore\CacheStoreInterface` interface.

```
$forecast->setCacheStore(new YourCacheStore());
```

### Retrieving the Weather Forecast

[](#retrieving-the-weather-forecast-1)

```
$forecast->getWeatherByLocation($latitude, $longitude);
```

If you need to change the units, you can set the units used in the response by using the method `setUnits()`:

```
$weather = $forecast::setUnits(\Uberboom\Forecast\Forecast::UNITS_SI)->getWeatherByLocation($latitude, $longitude);
```

Todo
----

[](#todo)

- Improve API documentation
- Provide unit tests

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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/d446fec88a40819e41035770b537a12d40146e7c95ef9e9e06f90286e5d3580c?d=identicon)[uberboom](/maintainers/uberboom)

---

Top Contributors

[![uberboom](https://avatars.githubusercontent.com/u/2630416?v=4)](https://github.com/uberboom "uberboom (13 commits)")

### Embed Badge

![Health badge](/badges/uberboom-forecast/health.svg)

```
[![Health](https://phpackages.com/badges/uberboom-forecast/health.svg)](https://phpackages.com/packages/uberboom-forecast)
```

PHPackages © 2026

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