dekiakbar/bmkg-api-php-client
Composer 安装命令:
composer require dekiakbar/bmkg-api-php-client
包简介
php api client for https://data.bmkg.go.id/
README 文档
README
This Project is used for scrapping data from https://data.bmkg.go.id/
Warning
It is mandatory to list BMKG (Meteorology, Climatology and Geophysics Agency) as data sources and display them on your application or system.
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
Before you install this package, make sure that the requirements below are met
PHP >= 5.6
php-xml
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
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
- 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
- PHP - The web scripting language used
- Packagist - Composer package repository
- BMKG - Used as data source
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
- Deki Akbar - Initial work
See also the list of contributors who participated in this project.
License
dekiakbar/bmkg-api-php-client 适用场景与选型建议
dekiakbar/bmkg-api-php-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 04 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「api」 「bmkg」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dekiakbar/bmkg-api-php-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dekiakbar/bmkg-api-php-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dekiakbar/bmkg-api-php-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Alfabank REST API integration
A wrapper package for the BMKG earthquake open data
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
A lightweight plain-PHP framework for database-backed CRUD APIs.
bughq error tracking - PHP SDK
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-05