Giter Site home page Giter Site logo

pravinshahi0007 / laravel-request-docs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rakutentech/laravel-request-docs

0.0 0.0 0.0 2.46 MB

Effortless API documentation tool for Laravel applications. Swagger alternative.

License: MIT License

JavaScript 0.51% PHP 52.46% TypeScript 45.48% CSS 1.29% Blade 0.05% Astro 0.21%

laravel-request-docs's Introduction

Laravel Request Docs

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

Try latest DEMO!

CI Node CI PHP codecov Latest Stable Version Total Downloads License

Fast Install on any Laravel Project

Hassle Free Auto Generate API Documentation for request rules and parameters

Analyze Inbuilt SQL query time analyzer, response time and headers output.

Supports Postman and OpenAPI 3.0.0 exports.

Features

  • Light and Dark mode
  • Automatic rules fetching from injected Request and by regexp
  • Automatic routes fetching from Laravel Routes
  • Support for Laravel logs
  • Support for SQL query and query time
  • Support for HTTP response time and memory consumption
  • Support for Authorization Headers
  • Support for File uploads
  • Support for Eloquents events
  • Display extra documentation using markdown
  • Saves history previous requests
  • Added filters to sort, group and filter routes by methods, controllers, middlewares, routes
  • 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 or 8.2
Laravel 6.* or 8.* or 9.* or 10.*

Installation

You can install the package via composer:

composer require rakutentech/laravel-request-docs

You can publish the config file with:

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

(optional) Add the following middleware to your API, so that the SQL logs and model events are captured.

app/Http/Kernel.php

        'api' => [
            ...
            \Rakutentech\LaravelRequestDocs\LaravelRequestDocsMiddleware::class,
            ... and so on

Usage

Dashboard

View in the browser on /request-docs/

Design pattern

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

Dark and Light Modes

  • Uses local storage to save the history of previous requests and request headers.
  • Request, SQL, response and events timeline below:

Settings to sort, group and filter

Extra

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

    /**
     * @lrd:start
     * Hello markdown
     * Free `code` or *text* to write documentation in markdown
     * @lrd:end
     */
    public function index(MyIndexRequest $request): Resource
    {

Params not in rules

You write extra params with rules with @LRDparam in the comment line as one line

    /**
     * @LRDparam username string|max:32
     * // either space or pipe
     * @LRDparam nickaname string|nullable|max:32
     * // override the default response codes
     * @LRDparam responses 200,422
     */
    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/

Star History

Star History Chart

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 Do not restrict to FormRequest
  • v1.18 Fix where prism had fixed height. Allow the 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 Ability 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
  • v1.27 A few fixes on width and added request_methods
  • v2.0 UI Renewal to React Static
    • @QAParam is now @LRDparam
    • No special changes for users, upgrade to v2.x as usual
    • Upgrading users will need to republish config
  • v2.1 UI - adds search bar and few alignment fixes on table
  • v2.2 PHP 8.1 and 8.2 support added - Groupby enabled for routes and controllers
  • v2.3 Bug fix for local storage (tabs) and full UI refactored after alpha
  • v2.4 Show version on navbar and curl is using ace editor
  • v2.5 Groupby final fix and local storage clear button. Other UI refactor
  • v2.6 File uploads
  • v2.7 Show activity on Eloquent models
  • v2.8 Show full activity on Eloquent models
  • v2.13 Bug fixes, and nested params support
  • v2.14 Adds path params support
  • v2.16 Top Navbar is fixed

Contributors

laravel-request-docs's People

Contributors

kevincobain2000 avatar kitloong avatar brel-pro avatar rawahamid avatar asurcodes avatar cdmathukiya avatar dedmytro avatar mizouzie avatar mdhesari avatar daprezjer avatar nimah79 avatar mello21century avatar farshadfakhar avatar digitall-it avatar eclips16 avatar justinphan1992 avatar laravel-shift 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.