PHP code example of marko / admin-api
1. Go to this page and download the library: Download marko/admin-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/ */
marko / admin-api example snippets
use Marko\AdminApi\ApiResponse;
use Marko\AdminAuth\Middleware\AdminAuthMiddleware;
use Marko\Routing\Attributes\Get;
use Marko\Routing\Attributes\Middleware;
use Marko\Routing\Http\Response;
#[Middleware(AdminAuthMiddleware::class)]
class OrderApiController
{
#[Get('/admin/api/v1/orders')]
public function index(): Response
{
return ApiResponse::paginated(
data: $orders,
page: 1,
perPage: 20,
total: 150,
);
}
}