Search documentation

Documentation

Laravel Guide

Modern alternative to Swagger with AI integration for Laravel applications.

Available Now
Overview
ByteDocs Laravel is a modern alternative to Swagger with better design, auto-detection, and AI integration for Laravel applications. It automatically generates beautiful API documentation from your Laravel routes with zero configuration required.
  • 🚀 Auto Route Detection - Automatically discovers and documents all your Laravel routes
  • 🎨 Beautiful Modern UI - Clean, responsive interface with dark mode support
  • 🤖 AI Integration - Built-in AI assistant with support for OpenAI, Gemini, Claude, and OpenRouter
  • 📱 Mobile Responsive - Works perfectly on all device sizes
  • 🔍 Advanced Search - Quickly find endpoints with powerful search functionality
  • 📊 OpenAPI Compatible - Generates standard OpenAPI 3.0 specifications
  • ⚡ Zero Configuration - Works out of the box with sensible defaults
  • 🔧 Highly Customizable - Configure everything to match your needs
  • 🔐 Security Features - Built-in authentication and IP banning protection
  • 📖 PHPDoc Support - Enhanced documentation with PHPDoc comments
Installation
Get started with Bytedocs in minutes.

Install package

composer require idnexacloud/laravel-bytedocs

Publish configuration (optional)

php artisan vendor:publish --provider="ByteDocs\Laravel\ByteDocsServiceProvider" --tag="bytedocs-config"
Quick Start
Key steps to generate documentation ready to share.

Access your documentation

ByteDocs automatically detects all your routes! Just visit /docs to see your documentation.

// No setup required - just visit:
http://your-app.test/docs

// The package automatically:
// - Discovers all Laravel routes
// - Generates beautiful documentation
// - Provides AI assistance (if configured)

Add route annotations (optional)

Enhance your documentation with PHPDoc comments for better descriptions and parameter details.

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\User;

class UserController extends Controller
{
    /**
     * Get all users with pagination support
     * @param page query integer false "Page number for pagination"
     * @param limit query integer false "Number of users per page"
     * @param search query string false "Search term to filter users"
     */
    public function index(Request $request)
    {
        return User::paginate($request->get('limit', 15));
    }

    /**
     * Create a new user account
     */
    public function store(Request $request)
    {
        return User::create($request->validated());
    }

    /**
     * Get user details by ID
     * @param id path integer true "User ID to retrieve"
     */
    public function show(User $user)
    {
        return $user;
    }
}

Configure AI integration (optional)

Enable AI assistance for your API documentation with support for multiple providers.

// Add to your .env file:
BYTEDOCS_AI_ENABLED=true
BYTEDOCS_AI_PROVIDER=openai  # or gemini, claude, openrouter
BYTEDOCS_AI_API_KEY=your-api-key-here
BYTEDOCS_AI_MODEL=gpt-4o-mini

// Or configure in config/bytedocs.php:
'ai' => [
    'enabled' => true,
    'provider' => 'openai',
    'api_key' => env('BYTEDOCS_AI_API_KEY'),
    'features' => [
        'chat_enabled' => true,
        'model' => 'gpt-4o-mini',
        'max_tokens' => 1000,
        'temperature' => 0.7,
    ],
],

Customize configuration

Configure base URLs, authentication, UI settings, and route detection modes.

// config/bytedocs.php
return [
    'title' => 'My API Documentation',
    'version' => '1.0.0',
    'description' => 'Comprehensive API for my application',

    'base_urls' => [
        ['name' => 'Production', 'url' => 'https://api.myapp.com'],
        ['name' => 'Staging', 'url' => 'https://staging-api.myapp.com'],
        ['name' => 'Local', 'url' => 'http://localhost:8000'],
    ],

    'docs_path' => '/docs',
    'auto_detect' => true,

    'route_detection' => [
        'mode' => 'api', // 'web', 'api', or 'both'
    ],

    'exclude_paths' => [
        '_ignition',
        'telescope',
        'horizon',
        'admin/*',
    ],

    'auth' => [
        'enabled' => false,
        'password' => env('BYTEDOCS_AUTH_PASSWORD'),
    ],

    'ui' => [
        'theme' => 'auto', // light, dark, auto
        'show_try_it' => true,
        'show_schemas' => true,
    ],
];
Sample Endpoint
Access your automatically generated API documentation with beautiful UI and optional AI assistance.
GET/docs
# Visit your documentation
curl http://your-app.test/docs

# Get raw API data
curl http://your-app.test/docs/api-data.json

# Download OpenAPI specification
curl http://your-app.test/docs/openapi.json