Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
I

idoc

> 后端框架
Open source

Generate beautiful interactive documentation and Open-API 3.0 spec file from your existing Laravel app.

185 stars0 likes0 views
WebsiteGitHub

About

Generate beautiful interactive documentation and Open-API 3.0 spec file from your existing Laravel app.

markdown
              Follow me anywhere @ovac4u                         | GitHub
              _________                          _________       | Twitter
             |   ___   |.-----.--.--.---.-.----.|  |  |.--.--.   | Facebook
             |  |  _   ||  _  |  |  |  _  |  __||__    |  |  |   | Instagram
             |  |______||_____|\___/|___._|____|   |__||_____|   | GitHub + @ovac
             |_________|                        www.ovac4u.com   | Facebook + @ovacposts

Introduction.

Laravel IDoc generator (interactive documentation generator) is a seamless and complete plugin for generating API documentation from your Laravel's codebase. It is inspired by the laravel-apidoc-generator, ReDoc and the Open API initiative from Swagger. IDoc has been built with extendability so that it can easily adapt with your use case.

Features

  • Extremely easy deployment
  • Server Side Rendering ready
  • The widest OpenAPI v2.0 features support

{.inline}

  • OpenAPI 3.0 support
  • Neat interactive documentation for nested objects

{.inline}

  • Automatic code sample support

{.inline}

  • Responsive three-panel design with menu/scrolling synchronization

  • Integrate API Introduction into side menu.

  • High-level grouping in side-menu.

  • Branding/customizations.

  • Redoc OSS for fast, beautiful reading

  • Optional Swagger UI side panel for live "Try it" requests

  • Tag or operation aware, stays in sync while you navigate

Installation

Note: PHP 7 and Laravel 5.5 or higher are the minimum dependencies.

bash
$ composer require ovac/idoc

Laravel

Publish the config file by running:

bash
php artisan vendor:publish --tag=idoc-config

This will create an idoc.php file in your config folder.

Lumen

  • Register the service provider in your bootstrap/app.php:
php
$app->bind('path.public', function ($app) { return $app->basePath('../your-public-path'); });
$app->register(\OVAC\IDoc\IDocLumenServiceProvider::class);
  • Copy the config file from vendor/ovac/idoc/config/idoc.php to your project as config/idoc.php. Then add to your bootstrap/app.php:
php
$app->configure('idoc');

Usage

bash
$ php artisan idoc:generate

Theme

  • The docs page includes a single Theme toggle (Auto → Dark → Light) that applies to both Redoc and the Swagger UI Try-It panel.
  • Auto follows your OS theme and updates live when the OS theme changes.
  • The choice persists in your browser via localStorage; no backend configuration is required.

AI Chat (optional)

The docs page ships with an optional, provider-agnostic AI assistant (ChatGPT‑style) that answers questions about your API using your generated OpenAPI document and optional extra context from a Blade view.

Highlights

  • Provider‑agnostic backend (configurable): DeepSeek (default), OpenAI (ChatGPT), Google Gemini, Groq, Hugging Face Inference API, Together AI, and OpenAI‑compatible self‑hosted servers (LM Studio, llama.cpp server).
  • Chat UI with Markdown + syntax highlighting; Copy action on AI replies; works across light/dark themes.
  • Built‑in Request Tester panel (inside Chat) to call any route, auto‑merging Authorization from Swagger Authorize and your extra headers; renders formatted responses.
  • Provider chooser appears in Chat if no key is configured, with one‑click guides and copyable .env snippets.
  • Edit & Resend: quickly update your last message and resubmit. The backend prunes the replaced turn to keep context clean.
  • Attachments: attach text, JSON, image (vision-capable models only), or URL. Text/JSON are added as short context snippets; images are included on user turns for OpenAI-compatible providers.
  • Endpoint-aware actions: when an assistant reply includes a heading like ### GET /path, the UI shows “Open endpoint” and “Try it with this data”. Try It auto-fills parameters/body from your message and executes.
  • Exports: download the chat as plain text, Markdown, or JSON ({ version: "idoc-1", messages: [...] }).

Customizing the chat system prompt

  • You can supply your own Markdown file that defines the default system prompt used to shape assistant replies.
  • Easiest path: publish and edit the bundled prompt. iDoc will automatically use the published copy if it exists.
    bash
    php artisan vendor:publish --tag=idoc-prompts
    # Edit resources/vendor/idoc/prompts/chat-system.md
  • Optional override: point to any file by setting the IDOC_CHAT_SYSTEM_PROMPT env var or idoc.chat.system_prompt_md in config.

Quick start (DeepSeek default)

Add to your .env:

env
IDOC_CHAT_ENABLED=true
IDOC_CHAT_PROVIDER=deepseek
IDOC_CHAT_MODEL=deepseek-chat
IDOC_CHAT_BASE_URL=https://api.deepseek.com/v1
DEEPSEEK_API_KEY=your_deepseek_key

Reload config/cache:

bash
php artisan config:clear && php artisan cache:clear

Other providers (examples)

  • OpenAI (ChatGPT)
    env
    IDOC_CHAT_ENABLED=true
    IDOC_CHAT_PROVIDER=openai
    IDOC_CHAT_MODEL=gpt-4o-mini
    IDOC_CHAT_BASE_URL=https://api.openai.com/v1
    OPENAI_API_KEY=your_openai_key
  • Google Gemini
    env
    IDOC_CHAT_ENABLED=true
    IDOC_CHAT_PROVIDER=google
    IDOC_CHAT_MODEL=gemini-1.5-flash
    IDOC_CHAT_BASE_URL=https://generativelanguage.googleapis.com/v1beta
    GOOGLE_API_KEY=your_google_api_key
  • Groq (OpenAI‑compatible)
    env
    IDOC_CHAT_ENABLED=true
    IDOC_CHAT_PROVIDER=groq
    IDOC_CHAT_MODEL=mixtral-8x7b-32768
    IDOC_CHAT_BASE_URL=https://api.groq.com/openai/v1
    GROQ_API_KEY=your_groq_key
  • Hugging Face Inference API (serverless)
    env
    IDOC_CHAT_ENABLED=true
    IDOC_CHAT_PROVIDER=huggingface
    IDOC_CHAT_MODEL=Qwen/Qwen2.5-7B-Instruct
    IDOC_CHAT_BASE_URL=https://api-inference.huggingface.co
    HF_API_TOKEN=your_hf_token
  • Self‑hosted (OpenAI‑compatible, e.g., llama.cpp server)
    env
    IDOC_CHAT_ENABLED=true
    IDOC_CHAT_PROVIDER=openai
    IDOC_CHAT_BASE_URL=http://127.0.0.1:8000/v1
    IDOC_CHAT_MODEL=qwen2.5-7b-instruct
    IDOC_CHAT_API_KEY=localdev

Tip: If Chat isn’t required, disable it by setting IDOC_CHAT_ENABLED=false.

Chat route middleware

  • Default: chat is stateless. iDoc removes web for chat and adds only throttling (throttle:60,1).
  • If any iDoc middleware needs session, either remove it from chat via chat.remove_middleware, or switch to a session‑backed chat by adding the session trio (EncryptCookies, AddQueuedCookiesToResponse, StartSession) to chat.middleware.
  • Because web may be included via the idoc group, iDoc excludes it for chat at group time when you set chat.remove_middleware.
  • See concise recipes in config/idoc.php.

Capability gating (attachments/vision)

  • The UI disables image selection when the current model does not support vision.
  • For providers that do not support attachments, the attachment row is hidden.

Configuration

Before you can generate your documentation, you'll need to configure a few things in your config/idoc.php.

  • path This will be used to register the necessary routes for the package.
php
'path' => 'idoc',
  • logo You can specify your custom logo to be used on the generated documentation. A relative or absolute url to the logo image.
php
'logo' => 'https://res.cloudinary.com/ovac/image/upload/h_300,w_380,c_fill,r_30,bo_20px_solid_white/aboust_ey5v1v.jpg',
  • title Here, you can specify the title to place on the documentation page.
php
'title' => 'iDoc API Reference',
  • description This will place a description on top of the documentation.
php
'description' => 'iDoc API specification and documentation.',
  • version Documentation version number.

  • terms_of_service This is the url to the terms and conditions for use your API.

  • contact Here you can configure contact information for support.

php
'contact' => [
        'name' => 'API Support',
        'email' => '[email protected]',
        'url' => 'http://www.ovac4u.com'
],
  • license A short and simple permissive license with conditions only requiring preservation of copyright and license notices
php
'license' => [
        'name' => 'MIT',
        'url' => 'https://github.com/ovac/idoc/blob/master/LICENSE.md'
],
  • output This package can automatically generate an Open-API 3.0 specification file for your routes, along with the documentation. This is the file path where the generated documentation will be written to. Default: public/docs

  • resources Locations of external resources, that can be customised for self-hosting if required.

php
'resources' => [
        'fonts' => '//fonts.googleapis.com/css?family=Roboto:400,700',
        'redoc_standalone_js' => 'https://cdn.jsdelivr.net/npm/[email protected]/bundles/redoc.standalone.js',
        'swagger_css' => 'https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui.css',
        'swagger_ui_js' => 'https://cdn.jsdelivr.net/npm/swagger-ui-dist@5/swagger-ui-bundle.js',
],
  • hide_download_button This section is where you can configure if you want a download button visible on the documentation.

  • router The router to use when processing the route (can be Laravel or Dingo. Defaults to Laravel)

  • servers The servers array can be used to add multiple endpoints on the documentation so that the user can switch between endpoints. For example, This could be a test server and the live server.

php
'servers' => [
   [
       'url' => 'https://www.ovac4u.com',
       'description' => 'App live server.',
   ],
   [
       'url' => 'https://test.ovac4u.com',
       'description' => 'App test server.',
   ],
],
  • tag_groups This array is used to separate groups that you have defined in little sections in the side menu. If you want to use it, make sure you add all groups because the unadded group will not be displayed.

  • external_description This option allows you to specify a route name for an external description that will be used in the documentation. If not provided, it will default to the route idoc.info. By default, it is set to idoc.info.

php
'external_description' => 'idoc.info', // Route name for external description, leave empty to use default description

Example usage:

php
'external_description' => 'idoc.info',
  • language-tabs This is where you can set languages used to write request samples. Each item in array is used to generate a request template for a given language. New languages can be added and the existing ones modified after. You can add or edit new languages tabs by publishing the view files and editing them or adding custom view files to:
php
'resources/views/vendor/idoc/languages/LANGUAGE.blade.php',
  • security This is where you specify authentication and authorization schemes, by default the HTTP authentication scheme using Bearer is setting but you can modify it, add others or even define it as null according to the requirements of your project. For more information, please visit Swagger Authentication.
php
'security' => [
       'BearerAuth' => [
           'type' => 'http',
           'scheme' => 'bearer',
           'bearerFormat' => 'JWT',
       ],
   ],
  • routes This is where you specify what rules documentation should be generated for. You specify routes to be parsed by defining conditions that the routes should meet and rules that should be applied when generating documentation. These conditions and rules are specified in groups, allowing you to apply different rules to different routes.

For instance, suppose your configuration looks like this:

…

This means documentation will be generated for routes in all domains ('*' is a wildcard meaning 'any character') which match any of the patterns 'api/*' or 'v2-api/*', excluding the 'users.create' route and any routes whose names begin with admin., and including the 'users.index' route and any routes whose names begin with healthcheck.. (The versions key is ignored unless you

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHPapiapi-documentationdocsdocumentation

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架