1. Go to this page and download the library: Download nawasara/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/ */
nawasara / api example snippets
use Nawasara\Api\Facades\Api;
public function boot(): void
{
// Register scope kalau package nawasara/api terpasang. Kalau tidak,
// skip — domain package tetap jalan tanpa API public.
if (class_exists(Api::class)) {
Api::registerScope('cctv.camera.read', 'List + detail kamera publik.');
Api::registerScope('cctv.camera.stream', 'Generate signed stream URL.');
}
// Load route api.php domain (mount di prefix /api/v1/cctv).
Route::prefix('api/v1/cctv')
->middleware(['api', 'api.auth', 'api.log'])
->group(__DIR__.'/../routes/api.php');
}