afiqiqmal/selangor-water-disruption

List of Water Disruption in Selangor

1.5.0 2019-10-25 03:40 UTC

README

Build Status Coverage Packagist Packagist

Simple List of Water Disruption in Selangor. This API is based on MySyabas App where i use the endpoint to form this packagist

Tested in PHP 7.1 Only

[No Longer Working The API only available in VPN]

Installation

Step 1: Install from composer

composer require afiqiqmal/selangor-water-disruption

Alternatively, you can specify as a dependency in your project's existing composer.json file

{
   "require": {
      "afiqiqmal/selangor-water-disruption": "^1.4.0"
   }
}

Usage

After installing, you need to require Composer's autoloader and add your code.

require_once __DIR__ .'/../vendor/autoload.php';

Sample for All List

$data = air_selangor()
	->disruption()
	->getList()
	->fetch();

Sample for All List by District

$data = air_selangor()
    ->disruption()
	->getList()
	->byDistrict("20") // byDistrict("20,00,10") // byDistrict(["20","00"])
	->fetch();

Sample for All Schedule List

$data = air_selangor()
	->disruption()
	->getList()
	->schedule() // schedule() or unscheduled()
	->byDistrict("20") // byDistrict("20,00,10") // byDistrict(["20","00"])
	->fetch();

Sample for All Schedule List by District

$data = air_selangor()
	->disruption()
	->getList()
	->schedule() // schedule() or unscheduled()
	->byDistrict("20") // byDistrict("20,00,10") // byDistrict(["20","00"])
	->fetch();

Sample for See Detail from the list by ID

$data = air_selangor()
	->disruption()
    ->detail("12345")
    ->fetch();

Usage for Water Dam (Get Information of Selangor Water Dam Water Level)

$data = air_selangor()
	->waterDam()
    ->fetch();

District Guide Code

00 => Kuala Lumpur
10 => Gombak
20 => Petaling
30 => Klang
40 => Hulu Langat
50 => Kuala Langat
60 => Hulu Selangor
70 => Kuala Selangor
80 => Sabak Bernam
90 => Sepang

Result

You should getting data similarly for listing like below:

{
    "code": 200,
    "error": false,
    "info": [
        {
            "code_id": "00",
            "name": "Kuala Lumpur",
            "data": [
                {
                    "id": "5107",
                    "type": 1,
                    "type_name": "Scheduled",
                    "title": "Kerja Pemasangan Injap di Taman Putra dan Taman Muda",
                    "location": null,
                    "affected_areas": "Taman Putra dan Taman Muda\r\n",
                    "affected_areas_filtered": [
                        "Taman Putra dan Taman Muda"
                    ],
                    "status": "Work Inprogress",
                    "start_date": 1526335200,
                    "start_date_formatted": "14/05/2018 10:00 PM",
                    "end_date": 1526446800,
                    "end_date_formatted": "16/05/2018 05:00 AM",
                    "district_id": "00",
                    "district_name": "Kuala Lumpur"
                }
            ],
            "count": 1
        },
        {
            "code_id": "10",
            "name": "Gombak",
            "data": [
                {
                    "id": "25458",
                    "type": 2,
                    "type_name": "Unscheduled",
                    "title": "Paip Pecah - Desa Makmur Batu 10",
                    "location": "Depan Kedai Makan, Jalan Gombak, Desa Makmur Batu 10, Gombak Utara, Selangor.",
                    "affected_areas": "1) Jalan Gombak Batu 9, Batu 10 & Batu 11\r\n2) Lorong Tokman",
                    "affected_areas_filtered": [
                        "1) Jalan Gombak Batu 9, Batu 10 & Batu 11",
                        "2) Lorong Tokman"
                    ],
                    "status": "Work Inprogress",
                    "start_date": 1525685640,
                    "start_date_formatted": "07/05/2018 09:34 AM",
                    "end_date": 0,
                    "end_date_formatted": null,
                    "district_id": "10",
                    "district_name": "Gombak"
                }
            ],
            "count": 1
        },
        {
            "code_id": "20",
            "name": "Petaling",
            "data": [
                {
                    "id": "25460",
                    "type": 2,
                    "type_name": "Unscheduled",
                    "title": "Paip Pecah - Kampung Baru Subang",
                    "location": "Jalan 4D, Kampung Baru Subang",
                    "affected_areas": "Jalan 2D - 10D, Kampung Baru Subang",
                    "affected_areas_filtered": [
                        "Jalan 2D - 10D, Kampung Baru Subang"
                    ],
                    "status": "Work Inprogress",
                    "start_date": 1525693560,
                    "start_date_formatted": "07/05/2018 11:46 AM",
                    "end_date": 0,
                    "end_date_formatted": null,
                    "district_id": "20",
                    "district_name": "Petaling"
                }
            ],
            "count": 1
        },
        {
            "code_id": "30",
            "name": "Klang",
            "data": [
                {
                    "id": "25461",
                    "type": 2,
                    "type_name": "Unscheduled",
                    "title": "Paip Pecah - Taman Klang Utama",
                    "location": "Jalan Sg Keramat 7E, Taman Klang Utama",
                    "affected_areas": "Taman Sg Keramat",
                    "affected_areas_filtered": [
                        "Taman Sg Keramat"
                    ],
                    "status": "Work Inprogress",
                    "start_date": 1525695660,
                    "start_date_formatted": "07/05/2018 12:21 PM",
                    "end_date": 0,
                    "end_date_formatted": null,
                    "district_id": "30",
                    "district_name": "Klang"
                }
            ],
            "count": 1
        },
        {
            "code_id": "40",
            "name": "Hulu Langat",
            "data": [
                {
                    "id": "25459",
                    "type": 2,
                    "type_name": "Unscheduled",
                    "title": "Paip Pecah - Jalan Besar Semenyih",
                    "location": "Stesen Petrol BHP, Jalan Besar Semenyih",
                    "affected_areas": "Kg Baru Cina Semenyih",
                    "affected_areas_filtered": [
                        "Kg Baru Cina Semenyih"
                    ],
                    "status": "Work Inprogress",
                    "start_date": 1525691100,
                    "start_date_formatted": "07/05/2018 11:05 AM",
                    "end_date": 0,
                    "end_date_formatted": null,
                    "district_id": "40",
                    "district_name": "Hulu Langat"
                }
            ],
            "count": 1
        },
        {
            "code_id": "50",
            "name": "Kuala Langat",
            "data": [],
            "count": 0
        },
        {
            "code_id": "60",
            "name": "Hulu Selangor",
            "data": [
                {
                    "id": "5106",
                    "type": 1,
                    "type_name": "Scheduled",
                    "title": "Kerja-kerja penggantian pam air mentah di Loji Rawatan Air Sungai Selisik",
                    "location": null,
                    "affected_areas": "1. Kampung Sungai Nilam/ Kampung Seri Pagi\r\n2. Kampung Lalang Sungai Selisik\r\n3. Rumah Murah Pkt 2 Sungai Selisek\r\n4. Kampung Serigala Sungai Selisek\r\n5. Kampung Orang Asli Serigala Sungai Selisek\r\n6. Kampong Bahom Sungai Selisek\r\n7. Kampong Sekolah, Kuarters Klinik\r\n8. Kampong Gesir Tengah Sungai Selisek",
                    "affected_areas_filtered": [
                        "1. Kampung Sungai Nilam/ Kampung Seri Pagi",
                        "2. Kampung Lalang Sungai Selisik",
                        "3. Rumah Murah Pkt 2 Sungai Selisek",
                        "4. Kampung Serigala Sungai Selisek",
                        "5. Kampung Orang Asli Serigala Sungai Selisek",
                        "6. Kampong Bahom Sungai Selisek",
                        "7. Kampong Sekolah, Kuarters Klinik",
                        "8. Kampong Gesir Tengah Sungai Selisek"
                    ],
                    "status": "Work Inprogress",
                    "start_date": 1526288400,
                    "start_date_formatted": "14/05/2018 09:00 AM",
                    "end_date": 1526353200,
                    "end_date_formatted": "15/05/2018 03:00 AM",
                    "district_id": "60",
                    "district_name": "Hulu Selangor"
                }
            ],
            "count": 1
        },
        {
            "code_id": "70",
            "name": "Kuala Selangor",
            "data": [],
            "count": 0
        },
        {
            "code_id": "80",
            "name": "Sabak Bernam",
            "data": [],
            "count": 0
        },
        {
            "code_id": "90",
            "name": "Sepang",
            "data": [],
            "count": 0
        }
    ],
    "generated_at": "2018-05-07 04:28:07",
    "footer": {
        "source": "Air Selangor MySyabas API",
        "developer": {
            "name": "Hafiq",
            "homepage": "https://github.com/afiqiqmal"
        }
    }
}

You should getting data similarly for DETAIL like below:

Sample

{
    "code": 200,
    "error": false,
    "info": {
        "id": "25454",
        "title": "Paip Bocor  - Taman Desa Impian",
        "detail": "Paip Bocor ",
        "detail_plain": "Paip Bocor ",
        "location": "Lot 107, Jln Desa Impian 2, Tmn Desa Impian, Kajang",
        "affected_areas": "Desa Impian & Sebahagian Sungai Kantan",
        "affected_areas_plain": "Desa Impian & Sebahagian Sungai Kantan",
        "level_disruption": "Normal",
        "status": "Work Inprogress",
        "start_date": 1525608000,
        "start_date_formatted": "May 06 2018, 12:00",
        "end_date": 1525629600,
        "end_date_formatted": "May 06 2018, 18:00",
        "timeline": [
            {
                "info": "Bekalan air telah kembali pulih.<br />Pihak kami memohon maaf diatas kesulitan yang dihadapi oleh pengguna sepanjang tempoh gangguan ini. Terima kasih.<br /><br />Tarikh/Masa Kerja Siap : May 06, 2018 08:30 PM",
                "info_plain": "Bekalan air telah kembali pulih.\nPihak kami memohon maaf diatas kesulitan yang dihadapi oleh pengguna sepanjang tempoh gangguan ini. Terima kasih.\n\nTarikh/Masa Kerja Siap : May 06, 2018 08:30 PM",
                "info_time": 1525639980,
                "info_time_formatted": "May 06 2018, 20:53"
            },
            {
                "info": "Kerja-kerja pembaikan siap. Bekalan air telah dibuka pada jam 5.30 petang dengan pemulihan keseluruhan kawasan adalah secara berperingkat. Terima kasih.",
                "info_plain": "Kerja-kerja pembaikan siap. Bekalan air telah dibuka pada jam 5.30 petang dengan pemulihan keseluruhan kawasan adalah secara berperingkat. Terima kasih.",
                "info_time": 1525629780,
                "info_time_formatted": "May 06 2018, 18:03"
            },
            {
                "info": "Kerja-kerja pembaikan sedang giat dijalankan. Bekalan air akan dibuka sejurus kerja-kerja pembaikan siap dengan pemulihan keseluruhan kawasan adalah secara berperingkat. Terima kasih",
                "info_plain": "Kerja-kerja pembaikan sedang giat dijalankan. Bekalan air akan dibuka sejurus kerja-kerja pembaikan siap dengan pemulihan keseluruhan kawasan adalah secara berperingkat. Terima kasih",
                "info_time": 1525610100,
                "info_time_formatted": "May 06 2018, 12:35"
            }
        ]
    },
    "generated_at": "2018-05-06 14:22:38",
    "footer": {
        "source": "Air Selangor MySyabas API",
        "developer": {
            "name": "Hafiq",
            "homepage": "https://github.com/afiqiqmal"
        }
    }
}

Water Dam Air Selangor

Sample Result

{
    "code": 200,
    "error": false,
    "info": [
        {
            "name": "Klang Gates",
            "built_date": "1959",
            "owner": "LEMBAGA URUS AIR SELANGOR (LUAS) Tingkat 12 & 13,  Bangunan Darul Ehsan  No. 3, Jalan Indah, Seksyen 14  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 - 5511 1800  Faks : 03 - 5510 1800",
            "operator": "PUNCAK NIAGA (M) SDN BHD Wisma Rozali  No. 4, Persiaran Sukan, Syeksen 13  40100 Shah Alam  Selangor Darul Ehsan  Tel : 03 – 5522 8589  Faks : 03 – 55101504",
            "status": "Berfungsi",
            "data": {
                "update_date": "15-05-201808:00 AM",
                "station": "Langat",
                "water_level_amount": "218.27",
                "water_level_metric": "m MSL",
                "reservoir": "28.86",
                "reservoir_metric": "Mm³",
                "reservoir_percentage": "84.66",
                "rain": "0.00",
                "rain_metric": "mm"
            }
        },
        {
            "name": "Langat",
            "built_date": "1979",
            "owner": "LEMBAGA URUS AIR SELANGOR (LUAS) Tingkat 12 & 13,  Bangunan Darul Ehsan  No. 3, Jalan Indah, Seksyen 14  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 - 5511 1800  Faks : 03 - 5510 1800",
            "operator": "PUNCAK NIAGA (M) SDN BHD Wisma Rozali  No. 4, Persiaran Sukan, Syeksen 13  40100 Shah Alam  Selangor Darul Ehsan  Tel : 03 – 5522 8589  Faks : 03 – 55101504",
            "status": "Berfungsi",
            "data": {
                "update_date": "15-05-201808:00 AM",
                "station": "Langat",
                "water_level_amount": "218.27",
                "water_level_metric": "m MSL",
                "reservoir": "28.86",
                "reservoir_metric": "Mm³",
                "reservoir_percentage": "84.66",
                "rain": "0.00",
                "rain_metric": "mm"
            }
        },
        {
            "name": "Tasik Subang",
            "built_date": "1950",
            "owner": "LEMBAGA URUS AIR SELANGOR (LUAS) Tingkat 12 & 13,  Bangunan Darul Ehsan  No. 3, Jalan Indah, Seksyen 14  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 - 5511 1800  Faks : 03 - 5510 1800",
            "operator": "PUNCAK NIAGA (M) SDN BHD Wisma Rozali  No. 4, Persiaran Sukan, Syeksen 13  40100 Shah Alam  Selangor Darul Ehsan  Tel : 03 – 5522 8589  Faks : 03 – 55101504",
            "status": "Berfungsi",
            "data": {
                "update_date": "15-05-201808:00 AM",
                "station": "Tasik Subang",
                "water_level_amount": "38.62",
                "water_level_metric": "m MSL",
                "reservoir": "4.21",
                "reservoir_metric": "Mm³",
                "reservoir_percentage": "100.00",
                "rain": "0.00",
                "rain_metric": "mm"
            }
        },
        {
            "name": "Sungai Tinggi",
            "built_date": "1995",
            "owner": "LEMBAGA URUS AIR SELANGOR (LUAS) Tingkat 12 & 13,  Bangunan Darul Ehsan  No. 3, Jalan Indah, Seksyen 14  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 - 5511 1800  Faks : 03 - 5510 1800",
            "operator": "Konsurtium ABASS Sdn Bhd Tingkat 15, Plaza Perangsang  Persiaran Perbandaran  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 – 5512 2660  Faks : 03 – 5511 4660",
            "status": "Berfungsi",
            "data": {
                "update_date": "15-05-201808:00 AM",
                "station": "Sg Tinggi",
                "water_level_amount": "59.61",
                "water_level_metric": "m MSL",
                "reservoir": "115.34",
                "reservoir_metric": "Mm³",
                "reservoir_percentage": "100.00",
                "rain": "0.00",
                "rain_metric": "mm"
            }
        },
        {
            "name": "Sungai Selangor",
            "built_date": "2001",
            "owner": "LEMBAGA URUS AIR SELANGOR (LUAS) Tingkat 12 & 13,  Bangunan Darul Ehsan  No. 3, Jalan Indah, Seksyen 14  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 - 5511 1800  Faks : 03 - 5510 1800",
            "operator": "Konsurtium ABASS Sdn Bhd Tingkat 15, Plaza Perangsang  Persiaran Perbandaran  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 – 5512 2660  Faks : 03 – 5511 4660",
            "status": "Berfungsi",
            "data": {
                "update_date": "15-05-201808:00 AM",
                "station": "Sg Selangor",
                "water_level_amount": "220.20",
                "water_level_metric": "m MSL",
                "reservoir": "230.00",
                "reservoir_metric": "Mm³",
                "reservoir_percentage": "100.00",
                "rain": "0.00",
                "rain_metric": "mm"
            }
        },
        {
            "name": "Semenyih",
            "built_date": "1985",
            "owner": "LEMBAGA URUS AIR SELANGOR (LUAS) Tingkat 12 & 13,  Bangunan Darul Ehsan  No. 3, Jalan Indah, Seksyen 14  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 - 5511 1800  Faks : 03 - 5510 1800",
            "operator": "Konsurtium ABASS Sdn Bhd Tingkat 15, Plaza Perangsang  Persiaran Perbandaran  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 – 5512 2660  Faks : 03 – 5511 4660",
            "status": "Berfungsi",
            "data": {
                "update_date": "15-05-201807:00 AM",
                "station": "Semenyih",
                "water_level_amount": "111.04",
                "water_level_metric": "m MSL",
                "reservoir": "59.22",
                "reservoir_metric": "Mm³",
                "reservoir_percentage": "100.25",
                "rain": "0.00",
                "rain_metric": "mm"
            }
        },
        {
            "name": "Sg. Labu Kolam Takungan",
            "built_date": "2011",
            "owner": "LEMBAGA URUS AIR SELANGOR (LUAS) Tingkat 12 & 13,  Bangunan Darul Ehsan  No. 3, Jalan Indah, Seksyen 14  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 - 5511 1800  Faks : 03 - 5510 1800",
            "operator": "Konsurtium ABASS Sdn Bhd Tingkat 15, Plaza Perangsang  Persiaran Perbandaran  40000 Shah Alam  Selangor Darul Ehsan  Tel : 03 – 5512 2660  Faks : 03 – 5511 4660",
            "status": "Berfungsi",
            "data": {
                "update_date": "15-05-201807:00 AM",
                "station": "Kolam Takungan Sg. Labu (ors)",
                "water_level_amount": "44.90",
                "water_level_metric": "m MSL",
                "reservoir": "9.26",
                "reservoir_metric": "Mm³",
                "reservoir_percentage": "99.62",
                "rain": "6.00",
                "rain_metric": "mm"
            }
        }
    ],
    "generated_at": "2018-05-15 06:16:47",
    "footer": {
        "source": "Lembaga Urus Air Selangor",
        "developer": {
            "name": "Hafiq",
            "homepage": "https://github.com/afiqiqmal"
        }
    }
}

Issue

  • If Issue happen like the api always return empty [], just let me know =)

License

Licensed under the MIT license

Credit

Credit to :

  • MySyabas Air Selangor
  • Lembaga Urus Air Selangor