aksoyih / earthquakes
Combines data from Kandilli, AFAD and USGS
Requires
- php: >=8.1
- ext-curl: *
- ext-iconv: *
- guzzlehttp/guzzle: 7.5.x-dev
- guzzlehttp/promises: 1.5
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-30 02:24:12 UTC
README
Features
This package makes the latest earthquake data available in an uniform format from Kandilli, AFAD and USGS sources.
Installation
The preferred way to install this extension is through composer.
Either run
composer require aksoyih/earthquakes
or add
"{package}": "aksoyih/earthquakes"
to the require section of your composer.json
file.
Usage/Examples
Firstly, require the autoloader from Composer
<?php require_once "vendor/autoload.php";
Use Aksoyih\Earthquakes\Earthquakes()
to create and initialize a Earthquakes instance.
$earthquakes = new Aksoyih\Earthquakes\Earthquakes();
This package can be used to either fetch the latest earthquake data from above mentioned sources, or fetch them by a given source. To fetch earthquakes data from all sources, you can use the the following example.
$earthquakeData = $earthquakes->getEarthquakesFromAllSources();
To fetch earthquakes from one source, you can use the following example.
$earthquakeData = $earthquakes->getEarthquakesFromSource('AFAD');
Example Data
[ { "timestamp": 1676822306, "date": "2023-02-19", "time": "15:58:26", "latitude": "38.173", "longitude": "38.104", "depth": "7.0", "magnitude": { "ml": "2.0", "mw": null, "mb": null }, "region": "Yeşilyurt (Malatya)", "solution_type": null, "additional_info": { "afad_earthquake_id": "550252" } }, { "timestamp": 1676822040, "date": "2023-02-19", "time": "15:54:00", "latitude": "38.503", "longitude": "40.268", "depth": "7.0", "magnitude": { "ml": "1.5", "mw": null, "mb": null }, "region": "Genç (Bingöl)", "solution_type": null, "additional_info": { "afad_earthquake_id": "550253" } } ]
TODO List
- Add sorting options
- Group earthquakes based on location, date and likelihood of being a single earthquake
- Add more sources
- Save data to some kind of database
- Add tests
Contributing
Contributions are always welcome!