PHP code example of dapodik-org / dapodik-laravel-api
1. Go to this page and download the library: Download dapodik-org/dapodik-laravel-api 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/ */
dapodik-org / dapodik-laravel-api example snippets
use Dapodik\Laravel\API\Facades\API;
use Illuminate\Support\Facades\Route;
// REST — ambil data peserta didik
Route::get('/dapodik-api', function () {
dd(
API::query('PesertaDidik', [
'pd_module' => 'pdterdaftar',
'limit' => 20,
])->toArray()
);
});
// WebService — ambil data sekolah lewat otorisasi
Route::get('/dapodik-api', function () {
dd(
API::connection('authorization')
->query('getSekolah')->toArray(),
API::connection('authorization')
->getSekolah()->toCollection(),
API::connection('authorization')
->getSekolah()->toJson(),
);
});