PHP code example of aksoyih / earthquakes

1. Go to this page and download the library: Download aksoyih/earthquakes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aksoyih / earthquakes example snippets




$earthquakes = new Aksoyih\Earthquakes\Earthquakes();


$earthquakeData = $earthquakes->getEarthquakesFromAllSources();

$earthquakeData = $earthquakes->getEarthquakesFromSource('AFAD');
json
[
    {
    "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"
    }
  }
]