PHPackages                             pyrrah/openweathermap-bundle - 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. [API Development](/categories/api)
4. /
5. pyrrah/openweathermap-bundle

ActiveSymfony-bundle[API Development](/categories/api)

pyrrah/openweathermap-bundle
============================

The simple way to obtain currently weather from OpenWeatherMap for Symfony 5 to 7

v1.1.0(3y ago)02601MITPHPPHP &gt;=7.2.5

Since Jul 23Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Pyrrah/OpenWeatherMapBundle)[ Packagist](https://packagist.org/packages/pyrrah/openweathermap-bundle)[ Docs](https://github.com/Pyrrah/OpenWeatherMapBundle)[ RSS](/packages/pyrrah-openweathermap-bundle/feed)WikiDiscussions main Synced 4w ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Pyrrah/OpenWeatherMap 🌞
=======================

[](#pyrrahopenweathermap-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b44ed0f97aa8c6b2e04abd51f98102d2fca94c1a76beb7504c2539adc494c6b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7079727261682f6f70656e776561746865726d61702d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pyrrah/openweathermap-bundle)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Contributors](https://camo.githubusercontent.com/1b210a2f7bc4ed3f8c97df5c679710dda745c62f6b23d3b32e9d7c339c388546/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f5079727261682f4f70656e576561746865724d617042756e646c653f7374796c653d666c61742d737175617265)](../../contributors)[![Total Downloads](https://camo.githubusercontent.com/43989359d619123490fecdbdccb1e407eb45049617e1a48b97fc83368e7a0c40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7079727261682f6f70656e776561746865726d61702d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pyrrah/openweathermap-bundle)

This bundle allows you to easily get the weather for a city or a location, via the OpenWeatherMap service.

Requirements
------------

[](#requirements)

- Symfony 5.\* to 7.\*
- API Key (APPID) from [OpenWeatherMap](https://home.openweathermap.org/users/sign_up)*²*
- Dependencies: [`Guzzle`](https://packagist.org/packages/guzzlehttp/guzzle)

*²Please note that the free version of OpenWeatherMap restricts the number of calls per month. Please see [documentation](https://openweathermap.org/price)). For a large number of calls, I recommend to setting up a cache (not currently managed in this package).*

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

[](#installation)

1. To install this bundle, run the following [Composer](https://getcomposer.org/) command :

```
composer require pyrrah/openweathermap-bundle

```

2. Check configuration file is correctly installed, and edit the default values with yours ([Official API docs](https://openweathermap.org/api)) :

```
  # config/packages/pyrrah_openweathermap.yaml
  pyrrah_open_weather_map:
      api_key: your_api_key
      api_url: https://api.openweathermap.org/data/2.5/
      units: metric
      language: en
```

Routing (optional)
------------------

[](#routing-optional)

If you don't want to expose the OpenWeatherMap API via your application, you can skip this section.

### Configuration

[](#configuration)

```
PyrrahOpenWeatherMapBundle:
    resource:		"@PyrrahOpenWeatherMapBundle/Controller/"
    type:		annotation
    prefix:		/openweathermap/api
```

This exposes the OpenWeatherMap API via /openweathermap/api. This means that instead of sending a request to  you can now send an unsigned request to /openweathermap/api/\*. Make sure you secure this area if you don't want others to be able to post on your behalf.

Usage
-----

[](#usage)

After installation and configuration, the service can be directly referenced from within your controllers.

```
