PHPackages                             dekiakbar/bmkg-api-php-client - 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. dekiakbar/bmkg-api-php-client

ActiveLibrary[API Development](/categories/api)

dekiakbar/bmkg-api-php-client
=============================

php api client for https://data.bmkg.go.id/

1.0.1(5y ago)216MITPHPPHP &gt;=7.2CI failing

Since Apr 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/dekiakbar/bmkg-api-php-client)[ Packagist](https://packagist.org/packages/dekiakbar/bmkg-api-php-client)[ Docs](https://github.com/dekiakbar/bmkg-api-php-client)[ RSS](/packages/dekiakbar-bmkg-api-php-client/feed)WikiDiscussions master Synced 4w ago

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

BMKG API PHP Client
===================

[](#bmkg-api-php-client)

 [![](https://camo.githubusercontent.com/aadf8ab641e248da803b2e14a9b571a43a15b74c2abc77e9b08efaf8ff35bb15/68747470733a2f2f7472617669732d63692e636f6d2f64656b69616b6261722f626d6b672d6170692d7068702d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/github/dekiakbar/bmkg-api-php-client) [![](https://camo.githubusercontent.com/e3f9ad369750fc540516d2400e4b6d489ecc72c5c9f25159eba264eb67867168/68747470733a2f2f706f7365722e707567782e6f72672f64656b69616b6261722f626d6b672d6170692d7068702d636c69656e742f76)](https://packagist.org/packages/dekiakbar/bmkg-api-php-client) [![](https://camo.githubusercontent.com/30ebf554e2ef47938776ee37513b4b6c8c104cf382e8d28b2e65507166f20dbd/68747470733a2f2f706f7365722e707567782e6f72672f64656b69616b6261722f626d6b672d6170692d7068702d636c69656e742f6c6963656e7365)](https://github.com/dekiakbar/bmkg-api-php-client/blob/master/LICENSE)

> This Project is used for scrapping data from

Warning
-------

[](#warning)

### **It is mandatory to list BMKG (Meteorology, Climatology and Geophysics Agency) as data sources and display them on your application or system.**

[](#it-is-mandatory-to-list-bmkg-meteorology-climatology-and-geophysics-agency-as-data-sources-and-display-them-on-your-application-or-system)

---

Getting Started
---------------

[](#getting-started)

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

### Prerequisites

[](#prerequisites)

Before you install this package, make sure that the requirements below are met

```
PHP >= 5.6
php-xml

```

### Installing

[](#installing)

To install this package, please follow the below instruction

Install via composer using below command

```
composer require dekiakbar/bmkg-api-php-client

```

And you're done, enjoy it :)

### Example Usage

[](#example-usage)

#### Forecast

[](#forecast)

- Get all forecast data by province, this method will return all city data including Temperature,Humidity,Wind Speed,Wind Direction and Weather, this method will return data type : **stdclass object**, if you did not passing any parameter to **execute()** method then it will return data for all province.

```
require_once __DIR__ . '/vendor/autoload.php';
use Dekiakbar\BmkgApiPhpClient\Forecast;
$data = new Forecast();
//this will return data only from  West java province
print_r($data->execute('JawaBarat')->getData());
//this will return data from all provinces
print_r($data->execute()->getData());
```

- Get available area code

```
//this will retun available area code, you can pass this area code to execute method
//this will return array
print_r($data->getAreaList());
```

- Get city list

```
//this will return available city list from West java province
print_r($data->execute('JawaBarat')->getCityList()->getData());
```

- Get data for specific city

```
//this will return data only for spesific city
print_r($data->execute('JawaBarat')->getDataByCityId('501212')->getData());
//this will return data for all city, coz there is no parameter passed to the function
print_r($data->execute('JawaBarat')->getDataByCityId()->getData());
```

- Get data list

```
//this will return available data id from specific city
print_r($data->execute('JawaBarat')->getDataByCityId('501212')->getDataList()->getData());
```

- Get specific data by Id, the data id can not be null, use **getDataList()** to get available data id.

```
//this will return specific data from specific city
print_r($data->execute('JawaBarat')->getDataByCityId('501212')->getDataById('hu')->getData());
```

#### Earthquake

[](#earthquake)

- Get earthquake data from bmkg open data, this method will return data type : **stdclass object**, if you did not passing any parameter to **execute()** method then it will return data as same as **autogempa** code.

```
require_once __DIR__ . '/vendor/autoload.php';
use Dekiakbar\BmkgApiPhpClient\Earthquake;

// Earthquake class initialization
$data = new Earthquake();

// This will method will get data from bmkg, then will fetch the data and return as StdClass onject
// if there is no parameter passed to the excute method then it will return defsult data (autogempa)
print_r( $data->execute()->getData() );

// With parameter example
print_r( $data->execute('lasttsunami')->getData() );
```

- Get available code list

```
// This will return available code list for execute method
print_r( $data->getCodeList() );
```

Built With
----------

[](#built-with)

- [PHP](https://www.php.net/) - The web scripting language used
- [Packagist](https://packagist.org/) - Composer package repository
- [BMKG](https://data.bmkg.go.id/) - Used as data source

Contributing
------------

[](#contributing)

Please fork this repository, and create new pull request if you want to contribute on this project.or open a new issue if you find something wrong with this project.

Authors
-------

[](#authors)

- [**Deki Akbar**](https://github.com/dekiakbar) - *Initial work*

See also the list of [contributors](https://github.com/dekiakbar/bmkg-api-php-client/graphs/contributors) who participated in this project.

License
-------

[](#license)

[![](https://camo.githubusercontent.com/30ebf554e2ef47938776ee37513b4b6c8c104cf382e8d28b2e65507166f20dbd/68747470733a2f2f706f7365722e707567782e6f72672f64656b69616b6261722f626d6b672d6170692d7068702d636c69656e742f6c6963656e7365)](https://github.com/dekiakbar/bmkg-api-php-client/blob/master/LICENSE)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~134 days

Total

2

Last Release

2085d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.5

1.0.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/ca73f1e344c31c29e2a54b0720d09af3398d0925de1431f185997642f3d4bd80?d=identicon)[dekiakbar](/maintainers/dekiakbar)

---

Tags

phpapibmkg

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dekiakbar-bmkg-api-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/dekiakbar-bmkg-api-php-client/health.svg)](https://phpackages.com/packages/dekiakbar-bmkg-api-php-client)
```

###  Alternatives

[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

13998.4k2](/packages/jstolpe-instagram-graph-api-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
