PHP code example of nunahsan / apidocs

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

    

nunahsan / apidocs example snippets


# controller file

public function method1(Request $request) {
    $ApiDocs = [
        "name" => "Auth : Login",
        "url" => "/api/test1",
        "method" => "POST",
        "description" => "This is api description",
        "validation" => [
            "header" => [
                "content-type" => "in:0,1",
                "seq" => "alidator = Validator::make($request->all(), $ApiDocs['validation']['body']);

    if ($validator->fails()) {
        return Response()->json($validator->errors());
    }
}