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 the scope only if nawasara/api is installed. If it is not,
// skip it; the domain package still works without a public API.
if (class_exists(Api::class)) {
Api::registerScope('cctv.camera.read', 'List + detail kamera publik.');
Api::registerScope('cctv.camera.stream', 'Generate signed stream URL.');
}
// Load the domain's api.php routes (mounted at prefix /api/v1/cctv).
Route::prefix('api/v1/cctv')
->middleware(['api', 'api.auth', 'api.log'])
->group(__DIR__.'/../routes/api.php');
}