PHP code example of afiqiqmal / esolat-malaysia

1. Go to this page and download the library: Download afiqiqmal/esolat-malaysia 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/ */

    

afiqiqmal / esolat-malaysia example snippets




$data = esolat()
        ->timeline()
        ->zone('PNG01')
        ->displayAs(Period::WEEK)
        ->fetch();

$data = (new WaktuSolat())
        ->zone('PNG01')
        ->displayAs(Period:WEEK)
        ->fetch();

$response = esolat()
        ->timeline()
        ->zone('PNG01') // P1 or PNG01
        ->displayAs(Period::DAY)
        ->setDate('2018-10-10') // if this is not set, it will automatically get current date
        ->fetch();

$response = esolat()
        ->timeline()
        ->zone('PNG01') // P1 or PNG01
        ->displayAs(Period::TODAY)
        ->fetch();

$response = esolat()
        ->timeline()
        ->zone('PNG01') // P1 or PNG01
        ->displayAs(Period::Week)
        ->setDate('2018-10-10') //if this is set, it will display the date range of startof week to end of week of the date
        ->fetch();

$data = esolat()
        ->timeline()
        ->zone('P1') // P1 or PNG01
        ->displayAs(Period::Month)
        ->month(4)
        ->fetch();

$data = esolat()
        ->timeline()
        ->zone('PNG01') // P1 or PNG01
        ->displayAs(Period::Year)
        ->fetch();

$data = esolat()
        ->timeline()
        ->locationProvider(6.6626, 100.3217, GOOGLE API KEY)
        ->displayAs(Period::Year)
        ->fetch();

$location = (new LocationProvider())
            ->setGoogleMapKey($key)
            ->setCoordinate($latitude, $longitude)
            ->fetch(); // Return ZoneData model
            
$location->getCode(); //R1            
$location->getJakimCode(); //PLS01            
$location->getState(); //Perlis            
$location->getZone(); //Padang Besar            
$location->toObject(); //return Object           
$location->toArray(); //return Array           

$data = esolat()->getLocations(); //return all
$data = esolat()->getLocations('negeri sembilan');
//or
$data = Location::getLocations($state);

$data = esolat()->getLocationByCode('PLS01');
$data = esolat()->getLocationByCode('R1');
//or
$data = Location::getLocationByCode($code);

$date = esolat()->date_to_hijri(\Carbon\Carbon::now(), $adjustment); // Return IslamicCarbon
$date->toDateIslamicString(); // 17-Ramadhan-1439
$date->month; // 9
$date->year; // 1439
$date->day; // 17
$date->islamic_month; // Ramadhan

$date = esolat()->hijri_to_date(17, 9, 1439, $adjustment); // Return Carbon

$data = esolat()->getNearbyMosque(2.9474,101.8451, "GOOGLE API", "RADIUS ex: 10000");
// or
$data = (new NearbyProvider("AIzaSyA6bZ53e_RhxutbU54IMY_qBB6T9A-iGxQ"))
    ->getNearbyLocation('mosque', 2.9474,101.8451);