vinkas/singapore

PHP SDK for Singapore's open data API

v0.3.2 2024-12-16 13:55 UTC

This package is auto-updated.

Last update: 2024-12-17 05:55:56 UTC


README

Tests Packagist Version

PHP SDK for Singapore's open data API https://data.gov.sg/datasets?formats=API

Installation

The package vinkas/singapore can be installed using composer via Packagist.

composer require vinkas/singapore

Usage

You can simply call the API endpoints by using the Connector class.

use Vinkas\Singapore\Api\Connector;

$connector = new Connector();
$response = $connector->weather()->rainfall();
$data = $response->object()->data;

$stations = $data->stations;
$readings = $data->readings;

Also, you can get all the details of Singapore regions, areas, subzones, and postal districts from the classes below. Some of these lists are created from the MIT Node package https://github.com/horensen/sg-areas

use Vinkas\Singapore\Data\Regions;
use Vinkas\Singapore\Data\Areas;
use Vinkas\Singapore\Data\Subzones;
use Vinkas\Singapore\Data\PostalDistricts;

Regions::all();
Areas::all();
Subzones::all();
PostalDistricts::all();