PHPackages                             alagiesinghateh/laravel-docmaker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. alagiesinghateh/laravel-docmaker

ActiveLibrary[API Development](/categories/api)

alagiesinghateh/laravel-docmaker
================================

A Laravel package to generate API documentation from controller annotations

v0.1.0(10mo ago)010MITBladePHP ^8.2

Since Aug 25Pushed 10mo agoCompare

[ Source](https://github.com/singhateh/laravel-docmaker)[ Packagist](https://packagist.org/packages/alagiesinghateh/laravel-docmaker)[ RSS](/packages/alagiesinghateh-laravel-docmaker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Laravel API Doc Generator
=========================

[](#laravel-api-doc-generator)

[![Issues](https://camo.githubusercontent.com/63ffd73e222d8f4130c26d5e49d194ec34d6a4d69d13cc198bcaa8271f2c9d9c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f73696e6768617465682f6c61726176656c2d646f636d616b6572)](https://github.com/singhateh/laravel-docmaker/issues)[![Latest Version](https://camo.githubusercontent.com/5ea1dca4e61c68047234ceb0c13721b1129c2c9f3fc301efb52993f845cbf3c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c6167696573696e6768617465682f6c61726176656c2d646f636d616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alagiesinghateh/laravel-docmaker)[![License](https://camo.githubusercontent.com/d1fbb9f682728e07cb9ae106885a8ae6e39a9fc6e8ca30c41ebc26c4fbed575b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73696e6768617465682f6c61726176656c2d646f636d616b6572)](https://github.com/singhateh/laravel-docmaker/license)[![Stars](https://camo.githubusercontent.com/e41e51393e5ea39a6d68b3fc2ac4ff9c527306aa819884ddab66fc1417ab1cc9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f73696e6768617465682f6c61726176656c2d646f636d616b6572)](https://github.com/singhateh/laravel-docmaker/stargazers)[![Total Downloads](https://camo.githubusercontent.com/953391ee3739defafc5a008d499bb54c7d7497bee4717d651d97098884d40957/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c6167696573696e6768617465682f6c61726176656c2d646f636d616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alagiesinghateh/laravel-docmaker)

A powerful Laravel package that automatically generates comprehensive API documentation from your controller annotations. Supports API Blueprint format with intelligent annotation parsing, authentication detection, and smart backup system.

---

 [![Laravel API Doc Generator](LARAVEL-API-DOC.gif)](LARAVEL-API-DOC.gif)

✨ Features
----------

[](#-features)

- **Automatic Annotation Generation**: Auto-generate `@api` annotations for your controller methods
- **Smart Parameter Detection**: Automatically detects route parameters, form request validation, and model bindings
- **Authentication Detection**: Intelligent detection of authentication requirements from middleware and parameters
- **Backup System**: Smart backup system that only creates backups when content changes
- **Web Interface**: Beautiful web interface to browse your API documentation
- **Security**: Built-in security with IP whitelisting and user authentication
- **Multiple Formats**: Supports API Blueprint format with JSON output
- **Cross-Platform**: Works with any Laravel application

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require alagiesinghateh/laravel-docmaker
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Alagiesinghateh\LaravelApiDocGenerator\ApiDocGeneratorServiceProvider" --tag="config"
```

Publish the views (optional):

```
php artisan vendor:publish --provider="Alagiesinghateh\LaravelApiDocGenerator\ApiDocGeneratorServiceProvider" --tag="views"
```

---

⚙️ Configuration
----------------

[](#️-configuration)

After publishing the config file, you can modify `config/api-doc-generator.php`:

```
return [
    'output_dir' => storage_path('docs/api'),

    'controller_paths' => [
        app_path('Http/Controllers/API'),
        app_path('Http/Controllers/Api'),
    ],

    'web_interface' => [
        'enabled' => true,
        'route_prefix' => 'api-docs',
        'middleware' => ['web', 'api-docs'],
    ],

    'security' => [
        'ip_whitelist' => ['127.0.0.1', '::1'],
        'restricted_paths' => [],
    ],

    'allowed_users' => [],

    'middleware' => [
        'detect' => true,
        'auth_middleware' => ['auth', 'auth:api', 'auth:sanctum'],
        'security_schemes' => [
            'auth' => 'bearer',
            'auth:api' => 'bearer',
            'auth:sanctum' => 'bearer',
        ],
        'exclude' => ['web', 'throttle', 'bindings'],
    ],

    'backup' => [
        'max_backups' => 10,
    ],

    'defaults' => [
        'method' => 'GET',
        'path' => '/api/endpoint',
        'name' => 'Untitled Endpoint',
        'group' => 'General',
    ],
];
```

---

🚀 Usage
-------

[](#-usage)

### Generate API Documentation

[](#generate-api-documentation)

```
# Generate documentation from controller annotations
php artisan singhateh:generate

# Force regenerate all annotations (even existing ones)
php artisan singhateh:generate --force

# Dry run (see what would change without modifying files)
php artisan singhateh:generate --dry-run
```

### Regenerate Controller Annotations

[](#regenerate-controller-annotations)

```
# Regenerate annotations for all controllers
php artisan singhateh:annotate:regenerate

# Regenerate for specific directory
php artisan singhateh:annotate:regenerate --path=Http/Controllers/API

# Cross-check without modifying files
php artisan singhateh:annotate:regenerate --cross-check

# Force regenerate all annotations
php artisan singhateh:annotate:regenerate --force
```

### Backup Management

[](#backup-management)

```
# List available backups
php artisan singhateh:backups:list

# Restore from latest backup
php artisan singhateh:backups:restore

# Restore specific backup
php artisan singhateh:backups:restore filename=api-docs_2023-12-15_143022.json
```

---

📖 Annotation Reference
----------------------

[](#-annotation-reference)

### Basic Annotation Structure

[](#basic-annotation-structure)

```
/**
 * @api {GET} /api/users Get Users
 * @apiName GetUsers
 * @apiGroup User
 * @apiDescription Retrieve a list of all users
 *
 * @apiParam {String} [page] Optional page number
 * @apiParam {String} [per_page] Optional items per page
 *
 * @apiSuccess {Object[]} data Array of users
 * @apiSuccess {Number} data.id User ID
 * @apiSuccess {String} data.name User name
 * @apiSuccess {String} data.email User email
 *
 * @apiSuccessExample {json} Success-Response:
 *     HTTP/1.1 200 OK
 *     {
 *         "data": [
 *             {
 *                 "id": 1,
 *                 "name": "John Doe",
 *                 "email": "john@example.com"
 *             }
 *         ]
 *     }
 *
 * @apiErrorExample {json} Error-Response:
 *     HTTP/1.1 500 Internal Server Error
 *     {
 *         "error": "Server error occurred"
 *     }
 */
public function index()
{
    // Controller logic
}
```

### Supported Annotations

[](#supported-annotations)

AnnotationDescriptionExample`@api`HTTP method and endpoint`@api {GET} /api/users Get Users``@apiName`Endpoint name`@apiName GetUsers``@apiGroup`Group/category`@apiGroup User``@apiDescription`Endpoint description`@apiDescription Get all users``@apiParam`Request parameter`@apiParam {String} name User name``@apiHeader`Request header`@apiHeader {String} Authorization Bearer token``@apiSuccess`Success response field`@apiSuccess {Number} id User ID``@apiError`Error response`@apiError {401} Unauthorized``@apiAuth`Authentication type`@apiAuth bearer``@apiMiddleware`Middleware used`@apiMiddleware auth:api``@apiPermission`Required permissions`@apiPermission users.read,users.write`---

🛡️ Security
-----------

[](#️-security)

The package includes built-in security features:

### Production Environment

[](#production-environment)

- API documentation is disabled by default in production
- Only allowed users (by email) can access
- IP whitelist support

### Development Environment

[](#development-environment)

- Localhost access allowed by default
- Configurable IP restrictions
- User-based access control

### Configuration Example

[](#configuration-example)

```
// config/api-doc-generator.php
'security' => [
    'ip_whitelist' => ['192.168.1.100', '10.0.0.0/24'],
    'restricted_paths' => ['internal', 'admin'],
],

'allowed_users' => [
    'admin@example.com',
    'developer@example.com',
],
```

---

🔧 Advanced Usage
----------------

[](#-advanced-usage)

### Custom Controller Properties

[](#custom-controller-properties)

```
class UserController extends Controller
{
    public static $apiParams = [
        'custom_param' => [
            'type' => 'string',
            'required' => true,
            'description' => 'Custom parameter description',
        ],
    ];
}
```

### Manual Annotation Overrides

[](#manual-annotation-overrides)

```
/**
 * @api {POST} /api/users Create User
 * @apiName CreateUser
 * @apiGroup User
 * @apiDescription Create a new user account
 *
 * @apiParam {String} name User's full name
 * @apiParam {String} email User's email address
 * @apiParam {String} password User's password
 *
 * @apiAuth bearer
 * @apiMiddleware auth:api
 */
public function store(CreateUserRequest $request)
{
    // Your controller logic
}
```

### Integration with Form Requests

[](#integration-with-form-requests)

```
class CreateUserRequest extends FormRequest
{
    public function rules()
    {
        return [
            'name' => 'required|string|max:255',
            'email' => 'required|email|unique:users',
            'password' => 'required|min:8|confirmed',
        ];
    }
}
```

---

🌐 Web Interface
---------------

[](#-web-interface)

Access the web interface at:
`http://your-app.com/api-docs`

!\[API Documentation Interface\]

 [![Laravel API Doc Generator](LARAVEL-API-DOC.gif)](LARAVEL-API-DOC.gif)

### Customizing the Web Interface

[](#customizing-the-web-interface)

Publish the views and modify them as needed:

```
php artisan vendor:publish --provider="Alagiesinghateh\LaravelApiDocGenerator\ApiDocGeneratorServiceProvider" --tag="views"
```

Views will be published to:
`resources/views/vendor/api-doc-generator/`

---

🔄 Backup System
---------------

[](#-backup-system)

The package includes a smart backup system:

- **Automatic Backups**: Created only when documentation content changes
- **Configurable Retention**: Keep last N backups (default: 10)
- **Easy Restoration**: Restore from any backup via artisan commands
- **Content-based**: Backups are created based on content changes, not file modifications

---

🧪 Testing
---------

[](#-testing)

Run the package tests:

```
composer test
```

---

🤝 Contributing
--------------

[](#-contributing)

We welcome contributions! Please see `CONTRIBUTING.md` for details.

1. Fork the project
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

---

📄 License
---------

[](#-license)

This package is open-source software licensed under the MIT license.

---

🐛 Bug Reports
-------------

[](#-bug-reports)

If you discover any bugs, please create an issue on GitHub.

---

📞 Support
---------

[](#-support)

For support and questions:

- Create an issue on GitHub
- Email:
- Documentation: [GitHub Wiki](https://github.com/alagiesinghateh/laravel-api-doc-generator/wiki)

---

🙏 Acknowledgments
-----------------

[](#-acknowledgments)

- Inspired by various API documentation generators
- Built with the Laravel framework
- Thanks to all contributors

> **Note**: This package is actively maintained. For the latest updates and features, always check the GitHub repository.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance54

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

312d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/43107984?v=4)[Alagie Singhateh](/maintainers/singhateh)[@singhateh](https://github.com/singhateh)

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alagiesinghateh-laravel-docmaker/health.svg)

```
[![Health](https://phpackages.com/badges/alagiesinghateh-laravel-docmaker/health.svg)](https://phpackages.com/packages/alagiesinghateh-laravel-docmaker)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M188](/packages/laravel-ai)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M129](/packages/roots-acorn)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[flarum/core

Delightfully simple forum software.

201.4M2.3k](/packages/flarum-core)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
