PHP code example of muammarsiddiqui / apideck-laravel
1. Go to this page and download the library: Download muammarsiddiqui/apideck-laravel 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/ */
muammarsiddiqui / apideck-laravel example snippets
// Define your DTO class
class CreateUserDTO {
public string $name;
public string $email;
public int $age;
public bool $isActive;
}
// In your routes or controller:
Route::post('api/users', function (CreateUserDTO $payload) {
return response()->json(['success' => true]);
});
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreUserRequest extends FormRequest {
public function rules() {
return [
'name' => '