PHP code example of dwolf555 / api-docs-controller

1. Go to this page and download the library: Download dwolf555/api-docs-controller 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/ */

    

dwolf555 / api-docs-controller example snippets


'Dwolf555\ApiDocsController\ApiDocsControllerServiceProvider',

class UserController extends Dwolf555\ApiDocsController\ApiDocsController {

    /**
     * Display a listing of the resource.
     *
     * @return Response
     */
    public function index()
    {
        // For documentation
        $this->apiDocInfo = [
            'wordOfWarning' => 'Just be ok, ok?',
            'exampleResponse' => ['message' => 'ok'],
            'inputs' => [
                'limit' => 10,
                'offset' => 0
            ],
            'possibleErrors' => [
                'limit' => 'Limit must be a valid integer.',
                'offset' => 'Limit must be a valid integer.',
            ]
        ];

        $content = array(
            'actualcontent' => 'realstuff'
        );
        $statusCode = 200;

        return $this->generateResponse($content, $statusCode);
    }

}