2017 © Pedro Peláez
 

library apidoc

IcyMat API Documentation creator

image

icymat/apidoc

IcyMat API Documentation creator

  • Wednesday, March 7, 2018
  • by IcyMat
  • Repository
  • 2 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

IcyMat API Documentation

Simple library to generate API documentation using PHP Annotations., (*1)

How to use

Add PHP Doc comments to your Controller classes., (*2)

<?php

namespace App\Controller;

...
use IcyMat\ApiDoc\Annotation\ApiMethod;
use IcyMat\ApiDoc\Annotation\ApiRoute;
use IcyMat\ApiDoc\Annotation\ApiDescription;
use IcyMat\ApiDoc\Annotation\ApiParams;
use IcyMat\ApiDoc\Annotation\ApiResponse;

class NotesController extends Controller
{
    /**
     * @ApiMethod(method="PUT")
     * @ApiRoute(name="/notes/{id}/save")
     * @ApiParams(name="title", type="string", nullable=false, required=true, description="New note title")
     * @ApiParams(name="content", type="string", nullable=true, required=false, description="New note text content")
     * @ApiParams(name="handwriting", type="string", nullable=true, required=false, description="New note handwriting content encoded using base64 algorithm")
     * @ApiParams(name="background", type="string", nullable=true, required=false, description="New note hex code of background color")
     * @ApiParams(name="pattern", type="string", nullable=true, required=false, description="New note pattern name; available: lines / checkered")
     * @ApiDescription(section="Notes", description="Save existing note changes")
     *
     * @ApiResponse(description="Success response", response="{'status': 'success'}")
     * @ApiResponse(description="Example error response", response="{'status': 'error', 'code': 403, 'message': 'Forbidden'}")
     */
    public function noteSave(Note $note, NotesManager $notesManager, Request $request)
    {
        if ($note->getUser() != $this->getUser()) {
            return new JsonResponse(['status' => 'error', 'code' => 'notes_01', 'message' => 'Access denied'], 403);
        }

        $notesManager->saveNoteFromRequest($note, $request);

        return new JsonResponse(['status' => 'success']);
    }
}

To generate doc you should use command, (*3)

php vendor/bin/api_docs_generator sourceDirectory destinationDirectory

After this operation in destinationDirectory/documentation.html you can find all documented methods., (*4)

Result, (*5)

The Versions

07/03 2018

dev-master

9999999-dev http://icymat.pl

IcyMat API Documentation creator

  Sources   Download

MIT

The Requires

 

by Mateusz Kolasa

api documentation

07/03 2018

0.4

0.4.0.0 http://icymat.pl

IcyMat API Documentation creator

  Sources   Download

MIT

The Requires

 

by Mateusz Kolasa

api documentation

07/03 2018

0.3

0.3.0.0 http://icymat.pl

IcyMat API Documentation creator

  Sources   Download

MIT

The Requires

 

by Mateusz Kolasa

api documentation

07/03 2018

0.2

0.2.0.0 http://icymat.pl

IcyMat API Documentation creator

  Sources   Download

MIT

The Requires

 

by Mateusz Kolasa

api documentation

07/03 2018

0.1

0.1.0.0 http://icymat.pl

IcyMat API Documentation creator

  Sources   Download

MIT

The Requires

  • php ^7.0

 

by Mateusz Kolasa

api documentation