2017 © Pedro Peláez
 

library api-docs-controller

image

dwolf555/api-docs-controller

  • Friday, January 10, 2014
  • by dwolf555
  • Repository
  • 1 Watchers
  • 1 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

ApiDocsController

Laravel controller class that allows for output of API docs if the "accept" header is not set to json., (*1)

Set up

Add the following to your composer.json and composer update / composer install, (*2)

{
    "require": {
        "dwolf555/api-docs-controller": "dev-master"
    }
}

Add the following to your app/config/app.php providers array, (*3)

'Dwolf555\ApiDocsController\ApiDocsControllerServiceProvider',

Example Controller

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);
    }

}

Example Output

Example Output, (*4)

The Versions

10/01 2014

dev-master

9999999-dev https://github.com/dwolf555/ApiDocsController.git

  Sources   Download

MIT

The Requires

 

by Avatar dwolf555

10/01 2014

v1.1

1.1.0.0 https://github.com/dwolf555/ApiDocsController.git

  Sources   Download

MIT

The Requires

 

by Daniel Wolf

10/01 2014

v1.0

1.0.0.0 https://github.com/dwolf555/ApiDocsController.git

  Sources   Download

MIT

The Requires

 

by Daniel Wolf