2017 © Pedro Peláez
 

library jot

Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.

image

code-orange/jot

Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.

  • Tuesday, November 28, 2017
  • by timvdalen
  • Repository
  • 3 Watchers
  • 5 Stars
  • 429 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 9 % Grown

The README.md

jot

Jot is a Laravel package that generates RESTful API documentation in Markdown based on PHPDoc., (*1)

Installation

To install jot with composer:, (*2)

composer require code-orange/jot

Laravel 5.5+

If you're using Laravel 5.5 or above, the package will automatically register the Jot provider., (*3)

Laravel 5.4

Add CodeOrange\Jot\JotServiceProvider::class to the providers array in config/app.php., (*4)

Configuration

You can use php artisan vendor:publish to publish the jot configuration to your application:, (*5)

php artisan vendor:publish --provider=CodeOrange\\Jot\\JotServiceProvider

Then, update config/jot.php., (*6)

Usage

Generating documentation

First, document your controller actions with PHPDoc., (*7)

class MyController {
    /**
     * Returns a value
     *
     * This method returns a cool value.
     *
     * @param mixed $b Some value
     * @return JsonResponse {
     *                          "a": 1,
     *                          "b": "Example"
     *                      }
     */
    public function myAction(Request $r) {
        return response()->json([
            'a' => 1,
            'b' => $r->get('b')
        ]);
    }
}

Then, run php artisan jot:generate. Markdown documenting your API will be printed to your console., (*8)

## Returns a value

This method returns a cool value.

`GET /example`

### Parameters

| Name | Located in | Description | Type |
| ---- | ---------- | ----------- | ---- |
|b|request|Some value|mixed|
|account|path|||

```json
{
    "a": 1,
    "b": "Example"
}
```

You can then add this Markdown to whatever you use to publish your docs. That can just be a Markdown file on GitHub, a wiki, or a self-hosted documentation site., (*9)

The Markdown is compatible with lord/slate, which is what we're using at Odyssey to publish our documentation., (*10)

Checking documentation coverage

Jot can also check if all of your public API methods are properly documented, for instance as part of your CI test pipeline., (*11)

php artisan jot:coverage

will exit with an error status code if there is a method in your API that is not documented., (*12)

Optionally, you can use --return to force all methods to have a documented return type/example., (*13)

Motivation

This project is heavily inspired by f2m2/apidocs. While that project generates excellent documentation, I didn't like the idea of a Laravel app hosting its own documentation (something that can be done statically and that probably has much different access patterns)., (*14)

Jot allows you to separate generation and publication of your API docs., (*15)

Read more about building Jot in this blogpost., (*16)

The Versions

28/11 2017

dev-master

9999999-dev

Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.

  Sources   Download

Apache-2.0

The Requires

 

by Tim van Dalen

laravel documentation phpdoc

17/10 2017

v1.3

1.3.0.0

Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.

  Sources   Download

Apache-2.0

The Requires

 

by Tim van Dalen

laravel documentation phpdoc

01/08 2017

v1.2

1.2.0.0

Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.

  Sources   Download

Apache-2.0

The Requires

 

by Tim van Dalen

laravel documentation phpdoc

01/08 2017

v1.1

1.1.0.0

Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.

  Sources   Download

Apache-2.0

The Requires

 

by Tim van Dalen

laravel documentation phpdoc

29/07 2017

v1.0

1.0.0.0

Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.

  Sources   Download

Apache-2.0

The Requires

 

by Tim van Dalen

laravel documentation phpdoc

29/07 2017

v0.1

0.1.0.0

Laravel package that generates RESTful API documentation in Markdown based on PHPDoc.

  Sources   Download

Apache-2.0

The Requires

 

by Tim van Dalen

documentation phpdoc