PHP code example of mohamedhekal / apiforge

1. Go to this page and download the library: Download mohamedhekal/apiforge 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/ */

    

mohamedhekal / apiforge example snippets


use Hekal\ApiForge\Facades\ApiForge;
use Illuminate\Support\Facades\Route;

Route::apiVersion('v1', function () {
    Route::get('/orders', fn () => ApiForge::ok(['orders' => []]));
});
// GET /api/v1/orders

ApiForge::fail('Out of stock', 'out_of_stock', 409, ['sku' => 'A1']);
throw new \Hekal\ApiForge\Exceptions\ApiException('Nope', 'conflict', 409);