thtroyer / noaa-cap-alerts
Parser for NOAA CAP files.
0.4.0
2022-06-05 02:55 UTC
Requires
- php: >=7.4 || >=8.0
- ext-xml: *
- pimple/pimple: ~3.5
Requires (Dev)
- phpunit/phpunit: ~9.5
README
What is this?
This is a PHP 7.3+ library to make it easier to fetch and use weather alerts created by NOAA.
Setup
Include noaa-cap-alerts into your project:
composer require thtroyer/noaa-cap-alerts
composer update
Dependencies
Make sure you have the XML extension installed for PHP.
e.g. sudo apt install php7.4-xml
Usage
Instantiate a new NoaaCapAlerts\NoaaAlerts object. Calling getAlerts() will download the latest alerts from NOAA, parse and return a set of data objects to be consumed.
$noaaAlerts = new NoaaCapAlerts\NoaaAlerts(); $alerts = $noaaAlerts->getAlerts(); foreach ($alerts as $alert) { echo $alert->getTitle(); }
See NoaaCapAlerts\Model\NoaaAlert class to see what data is currently available.
Features are still being added, so some changes may not be backwards compatible. Until 1.0, treat new feature versions (0.x) as breaking updates.
More information about NOAA's CAP format is available here.