1. Go to this page and download the library: Download cyberbugz/dust 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/ */
cyberbugz / dust example snippets
#[Route(Http::POST, '/users', 'users.store')]
public function store() {
return response()->json(['message' => 'User created']);
}
#[Middleware(['auth', 'throttle:60,1'])]
public function update() {
return response()->json(['message' => 'Middleware applied']);
}
#[Guard('api')]
public function index() {
return response()->json(['message' => 'Secured by API guard']);
}
#[Prefix('admin')]
#[Route(Http::GET, '/dashboard')]
public function dashboard() {
return response()->json(['message' => 'Admin dashboard']);
}
return new ErrorResponse('An error occurred.', ['error_code' => 123], 400);
throw new RouteDefinitionMissing('Custom error message');
#[Middleware(['auth'])]
#[Guard('api')]
#[Prefix('admin')]
#[Route(Http::GET, '/users', 'users.index')]
public function index() {
return response()->json(['message' => 'Admin API Users']);
}