Code Monkey home page Code Monkey logo

laravel-request-docs's Introduction

Laravel Request Docs

The Hassle-Free automatic API documentation generation for Laravel.
A Swagger alernative.
Supports Open API 3.0.0

Fast: Install on any Laravel Project

Hassle Free: Auto Generate API Documentation for request rules and parameters

Analyze: In built SQL query time analyzer, response time and headers output.

Supports: Postman and OpenAPI 3.0.0 exports.

Features

  • Automatic routes fetching from Laravel Routes
  • Automatic rules fetching from injected Request
  • Support for Authorization Headers
  • Support for SQL query, response time and memory consumption by request on Laravel
  • Intelligent auto request builder using faker.js
  • Display extra documentation using markdown
  • Export laravel API, routes, rules and documentation to Postman and OpenAPI 3.0.0

Read on Medium

Automatically generate api documentation for Laravel without writing annotations.

Read more: https://medium.com/web-developer/laravel-automatically-generate-api-documentation-without-annotations-a-swagger-alternative-e0699409a59e

Requirements

Lang Versions
PHP 7.4 or 8.0 or 8.1
Laravel 6.* or 8.* or 9.*

Installation

You can install the package via composer:

composer require rakutentech/laravel-request-docs --dev

You can publish the config file with:

php artisan vendor:publish --tag=request-docs-config

Usage

Dashboard

View in the browser on /request-docs/

Generate a static HTML and open api specification

php artisan lrd:generate

Docs HTML is generated inside docs/.

Just want Open API

View in the browser on /request-docs/?openapi=true

Design pattern

In order for this plugin to work, you need to follow the design pattern by injecting the request class inside the controller. For extra documentation you can use markdown inside your controller method as well.

Design pattern

Screenshots

Generated API documentation

Preview

Try API

Preview

SQL query profile

Preview

Response profile

Preview

Customize Headers

Preview

Extra

You write extra documentation in markdown which will be rendered as HTML on the dashboard. Example of using it in controller

    /**
     * @lrd:start
     * #Hello markdown
     * ## Documentation for /my route
     * @lrd:end
     */
    public function index(MyIndexRequest $request): Resource
    {

Custom Params

You write extra params with rules with @QAparam comment line

    /**
     * @QAparam search string
     */
    public function index(MyIndexRequest $request): Resource
    {
    /**
     * @QAparam search string nullable max:32
     */
    public function index(MyIndexRequest $request): Resource
    {

Testing

./vendor/bin/phpunit

Linting

./vendor/bin/phpcs --standard=phpcs.xml --extensions=php --ignore=tests/migrations config/ src/

Fixing lints

./vendor/bin/php-cs-fixer fix src/
./vendor/bin/php-cs-fixer fix config/

Changelog

  • Initial Release
  • v1.9 Added improvements such as status code, response headers, custom request headers and fixed issues reported by users
  • v1.10 Show PHP memory usage, gzip encoding fix
  • v1.12 Bug Fix of id, and Laravel 9 support
  • v1.13 Laravel 9 support
  • v1.15 Adds Filter and fall back to regexp upon Exception
  • v1.17 Donot restrict to FormRequest
  • v1.18 Fix where prism had fixed height. Allow text area resize.
  • v1.18 Updated UI and pushed unit tests
  • v1.19 Exception -> Throwable for type error
  • v1.20 Feature support open api 3.0.0 #10
  • v1.21 Abililty to add custom params
  • v1.22 Boolean|File|Image support
  • v1.22 Boolean|File|Image support
  • v1.23 Bug fix for lrd doc block #76

laravel-request-docs's People

Contributors

kevincobain2000 avatar dedmytro avatar kitloong avatar mdhesari avatar nimah79 avatar rawahamid avatar mello21century avatar cdmathukiya avatar farshadfakhar avatar digitall-it avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.