PHPackages                             cakephp-fr/openweathermap - 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. cakephp-fr/openweathermap

ActiveCakephp-plugin

cakephp-fr/openweathermap
=========================

Openweathermap plugin for CakePHP

014PHP

Since Feb 16Pushed 10y ago3 watchersCompare

[ Source](https://github.com/cakephp-fr/openweathermap)[ Packagist](https://packagist.org/packages/cakephp-fr/openweathermap)[ RSS](/packages/cakephp-fr-openweathermap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Openweathermap plugin for CakePHP v3
====================================

[](#openweathermap-plugin-for-cakephp-v3)

[![Build Status](https://camo.githubusercontent.com/45367764bc646f9b2dce25b9a3b9ea0c2ae4014dfe410fd922433ecef50ca468/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f63616b657068702d66722f6f70656e776561746865726d61702e7376673f6272616e63683d6d6173746572)](http://travis-ci.org/cakephp/localized)[![License](https://camo.githubusercontent.com/ce50f2f7ec471649b24f69561022b647586c6c0033ac5c0fca1d0fd968f6ca21/68747470733a2f2f706f7365722e707567782e6f72672f63616b657068702d66722f6f70656e776561746865726d61702f6c6963656e73652e737667)](https://packagist.org/packages/cakephp-fr/openweathermap)[![Total Downloads](https://camo.githubusercontent.com/4b7c1aa73f57b863386202d74765a49417cccc8a8251f9e058338741ef3e2321/68747470733a2f2f706f7365722e707567782e6f72672f63616b657068702d66722f6f70656e776561746865726d61702f642f746f74616c2e737667)](https://packagist.org/packages/cakephp-fr/openweathermap)

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org). The recommended way to install composer packages is:

```
composer require cakephp-fr/openweathermap:dev-master
```

Load your plugin using:

```
bin/cake plugin load Openweathermap
```

or add manually `CakePlugin::load('Localized')` in your `boostrap.php`.

Create 2 tables : weatherdatas &amp; weathersites with the help of initial migration file into 'Migrations' directory of the plugin (/Openweathermap/configs/Migrations)

```
bin/cake migrations migrate -p Openweathermap
```

Configuration
-------------

[](#configuration)

To configure the plugin you can add the openweathermap config to the config/app.php, something like:

```
return [

    .... (other configs before)

    'Openweathermap' => [
        // MANDATORY : Register API keys at openweathermap.org
        'key' => 'your-sitekey',
        // OPTIONAL : default lang for the plugin. Default to 'fr' if this config is not provided
        'lang' => 'en',
        // OPTIONAL : default units mesure for the plugin. Default to 'metric' if this config is not provided
        'units' => 'metric'
    ]
]
```

Make sure that /config/app.php file is in .gitignore. The secret key must stay secret. The API Key is mandatory, if you want an API go to the openweathermap.org and follow instructions.

Using
-----

[](#using)

You can fetch weather forecast for any cities with theses 3 functions:

- getWeatherByCityId
- getWeatherByCityName
- getWeatherByGeoloc

For example into a shell code : for this example, a $sites table contain every information about the city (name, long/lat or weathersite\_id):

```
public function main()
{
    // parse all sites
    $sites = $this->Sites->find('all');
    foreach ($sites as $site) {
        $this->out('site : ' . $site->libelle);
        if ($site->has('weathersite_id')) {
            $data = $this->Openweathermap->getWeatherByCityId($site->weathersite_id);
        } elseif ($site->has('latitude') || !$site->has('longitude')) {
            $data = $this->Openweathermap->getWeatherByGeoloc($site->latitude, $site->longitude);
            if ($data['success']) {
                $this->Sites->associateOpenweatherSite($site->id, $data['data']['city']['id']); // $data['data']['city']['id'] will contain the id from Openweathermap of the city
            }
        } else {
            $data = $this->Openweathermap->getWeatherByCityName($site->ville, 'FR');
            if ($data['success']) {
                $this->Sites->associateOpenweatherSite($site->id, $data['data']['city']['id']); // $data['data']['city']['id'] will contain the id from Openweathermap of the city
            }
        }
        sleep(2); // for unstress the server
    }
}
```

Everytime you fetch weatherdata, the component check if the request is more than 6 hours old, otherwise the component will return weatherdata from database instead of updating it.

**Don't use XML or HTML format, it's not implemented for the moment**

Future
------

[](#future)

I'm coding a Weather Helper which can display icon (css) or image from weather information.

End
---

[](#end)

Sorry for my very bad english (i'm a french guy), if you see some errors, please do a pull request. If you want more informations, you can ask your questions into the issues section of this page.

you can send me a mail at cyberbobjr(at)yahoo(dot)com

Regards

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

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

---

Top Contributors

[![cake17](https://avatars.githubusercontent.com/u/1652972?v=4)](https://github.com/cake17 "cake17 (7 commits)")

### Embed Badge

![Health badge](/badges/cakephp-fr-openweathermap/health.svg)

```
[![Health](https://phpackages.com/badges/cakephp-fr-openweathermap/health.svg)](https://phpackages.com/packages/cakephp-fr-openweathermap)
```

PHPackages © 2026

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