tuxonice/ipma-api

PHP Package to manage IPMA API (https://api.ipma.pt/)

Maintainers

Package info

github.com/tuxonice/ipma-api

pkg:composer/tuxonice/ipma-api

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.3.0 2026-03-27 16:06 UTC

README

Latest Version on Packagist GitHub Tests Action Status Total Downloads License

This PHP package provides an easy-to-use interface for the IPMA (Instituto Português do Mar e da Atmosfera, I. P.) API. It allows you to fetch weather forecasts, observation data, and other auxiliary information directly into your PHP application.

For more information about the official API, please visit https://api.ipma.pt/ (only in Portuguese).

Warning: This is a work in progress package! While it is actively maintained, some features may be incomplete or subject to change.

Getting Started

Prerequisites

  • PHP 8.2 or higher
  • Composer

Installation

composer require tuxonice/ipma-api

Usage

Here are a few examples of how to use this package.

Get Daily Weather Forecast

use Tlab\IpmaApi\IpmaForecast;

$api = IpmaForecast::createDailyWeatherForecastByDayApi();
$result = $api->from(1020500) // Location ID for Beja
              ->filterByMaxTemperatureRange(18.0, 19.0)
              ->get();

Get Seismic Information

use Tlab\IpmaApi\IpmaService;
use Tlab\IpmaApi\Enums\SeismicInformationAreaEnum;

$api = IpmaService::createSeismicInformationApi();
$events = $api->from(SeismicInformationAreaEnum::MAIN_LAND_AND_MADEIRA)
              ->get();

For more detailed examples and a full list of available endpoints, please see the documentation folder.

Running Tests

This project uses PHPUnit for testing. To run the test suite, you can use the provided Makefile command:

make test

To generate a code coverage report, run:

make coverage

The report will be generated in the coverage/ directory.

Contributing

Contributions are welcome! If you would like to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with a descriptive message.
  4. Push your changes to your fork.
  5. Submit a pull request to the main repository.

Please ensure that your code follows the existing coding style and that all tests pass before submitting a pull request.