PHPackages                             badass-dd/lazy-docs - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. badass-dd/lazy-docs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

badass-dd/lazy-docs
===================

Intelligent PHPDoc generator for Laravel API controllers with natural language support

v1.0.0(3mo ago)01MITPHPPHP ^8.1

Since Jan 22Pushed 3mo agoCompare

[ Source](https://github.com/badass-dd/lazy-docs)[ Packagist](https://packagist.org/packages/badass-dd/lazy-docs)[ Docs](https://github.com/badass-dd/lazy-docs)[ RSS](/packages/badass-dd-lazy-docs/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Lazy Docs - Laravel PHPDoc Generator
====================================

[](#lazy-docs---laravel-phpdoc-generator)

🚀 **Automatically generate intelligent, natural-language PHPDoc for your Laravel API controllers** - perfectly compatible with **Laravel Scribe**

Features
--------

[](#features)

✨ **95% Laravel Pattern Coverage**

- CRUD operations (index, show, store, update, destroy)
- Transactions with rollback detection
- Queue jobs and async operations
- Caching strategies
- Complex query builders with filters
- Relations and eager loading
- Soft deletes
- Authorization checks
- Rate limiting
- Validation rules parsing
- Exception/error handling
- Search, filter, pagination patterns
- Repository pattern support
- Custom methods with intelligent analysis

🎯 **Natural Language Documentation**

- Reads like a human wrote it
- Fully compatible with **Laravel Scribe**
- Multi-step process descriptions
- Contextual details based on code analysis
- Implementation notes for complex methods

📊 **Smart Detection**

- Reflection-based method analysis
- FormRequest rule extraction
- Exception to HTTP status mapping
- Relation detection
- Complexity scoring

🔧 **Production Ready**

- No external dependencies beyond Laravel
- Works with Laravel 10+ &amp; 11
- Single command or method-specific generation
- Dry-run preview mode
- Overwrite existing PHPDoc option

Installation
------------

[](#installation)

```
composer require badass-dd/lazy-docs
```

Quick Start
-----------

[](#quick-start)

### Generate for all controllers

[](#generate-for-all-controllers)

```
php artisan generate:controller-docs --all
```

### Generate for specific controller

[](#generate-for-specific-controller)

```
php artisan generate:controller-docs OrderController
```

### Generate for specific method only

[](#generate-for-specific-method-only)

```
php artisan generate:controller-docs OrderController --method=store
```

### Preview first (dry-run)

[](#preview-first-dry-run)

```
php artisan generate:controller-docs --all --dry-run
```

### Replace existing PHPDoc

[](#replace-existing-phpdoc)

```
php artisan generate:controller-docs --all --overwrite
```

Command Syntax
--------------

[](#command-syntax)

### Full Signature

[](#full-signature)

```
php artisan generate:controller-docs
    {controller?}           # Controller name or path (optional)
    {--method=}             # Specific method name (optional)
    {--all}                 # Generate for all controllers
    {--overwrite}           # Replace existing PHPDoc
    {--dry-run}             # Preview without writing
    {--force}               # Include simple methods
```

### Examples

[](#examples)

```
# Generate for single controller
php artisan generate:controller-docs OrderController

# Generate for single method
php artisan generate:controller-docs OrderController --method=store

# Generate all with preview
php artisan generate:controller-docs --all --dry-run

# Overwrite existing documentation
php artisan generate:controller-docs OrderController --overwrite

# Include simple methods
php artisan generate:controller-docs --all --force
```

Output Example
--------------

[](#output-example)

### Before

[](#before)

```
public function store(CreateOrderRequest $request): JsonResponse
{
    return DB::transaction(function () use ($request) {
        $order = Order::create($request->validated());
        OrderCreated::dispatch($order);
        return response()->json($order, 201);
    });
}
```

### After (Auto-Generated)

[](#after-auto-generated)

```
/**
 * Create a new order.
 *
 * This operation includes request validation, database transaction with automatic
 * rollback, and asynchronous background jobs.
 *
 * @bodyParam customer_id integer required Customer ID. Example: 1
 * @bodyParam total_amount number required Order total in USD. Example: 99.99
 * @bodyParam items array required Array of order items. Example: []
 *
 * @response 201 {
 *   "id": 1,
 *   "customer_id": 1,
 *   "total_amount": 99.99,
 *   "status": "pending",
 *   "message": "Order created successfully"
 * }
 *
 * @response 422 {
 *   "message": "Validation failed",
 *   "errors": {
 *     "customer_id": ["The customer_id field is required"]
 *   }
 * }
 *
 * @response 403 {
 *   "message": "This action is unauthorized"
 * }
 *
 * ⚠️ This operation is executed within a database transaction with automatic rollback on error.
 * 🔄 Background jobs are dispatched asynchronously and may not complete immediately.
 */
public function store(CreateOrderRequest $request): JsonResponse
```

Pattern Recognition
-------------------

[](#pattern-recognition)

The generator automatically detects and documents:

### CRUD Operations

[](#crud-operations)

```
public function index() { }         // "Retrieve a list of..."
public function show($id) { }       // "Retrieve a specific..."
public function store() { }         // "Create a new..."
public function update() { }        // "Update an existing..."
public function destroy() { }       // "Delete a..."
```

### Transactions

[](#transactions)

```
DB::transaction(function () {
    Order::create(...);
    Payment::create(...);
});
// → "executed within a database transaction with automatic rollback"
```

### Queue Jobs

[](#queue-jobs)

```
SendEmail::dispatch($user);
NotifyAdmin::dispatch($data);
// → "dispatching asynchronous background jobs"
```

### Caching

[](#caching)

```
Cache::remember('orders', 60, fn() => Order::all());
// → "results cached for 60 minutes"
```

### Complex Queries

[](#complex-queries)

```
Order::with(['customer', 'items'])
    ->when($request->status, fn($q) => $q->where('status', $request->status))
    ->orderBy($request->sort ?? 'created_at')
    ->paginate($request->per_page ?? 15);
// → "with advanced filtering, sorting, and pagination including related resources"
```

### Authorization

[](#authorization)

```
$this->authorize('update', $order);
// → "requiring proper authorization" + @response 403
```

### Rate Limiting

[](#rate-limiting)

```
$this->throttle('update-order');
// → @response 429 Too Many Requests
```

### Soft Deletes

[](#soft-deletes)

```
Order::withTrashed()->find($id);
// → "respecting soft-deleted records"
```

### Form Requests with Validation

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

```
class CreateOrderRequest extends FormRequest
{
    public function rules()
    {
        return [
            'customer_id' => 'required|integer|exists:customers,id',
            'total_amount' => 'required|numeric|min:0.01',
            'items' => 'required|array|min:1',
        ];
    }
}
// → Auto-generates @bodyParam with validation rules
```

Configuration
-------------

[](#configuration)

Publish config:

```
php artisan vendor:publish --provider="Badass\ControllerPhpDocGenerator\ControllerPhpDocGeneratorServiceProvider" --tag=phpdoc-generator-config
```

Edit `config/phpdoc-generator.php`:

```
return [
    'complexity_threshold' => 5,  // Skip simple methods

    'exclude_methods' => [
        '__construct',
        'middleware',
        'your_method_name',
    ],

    'examples' => [
        'email' => 'user@example.com',
        'id' => '1',
        // Add custom field examples
    ],

    'include_implementation_notes' => true,
    'include_authorization_errors' => true,
    'include_rate_limit_info' => true,
];
```

Integration with Scribe
-----------------------

[](#integration-with-scribe)

After generating PHPDoc:

```
# Install Scribe
composer require knuckleswtf/scribe

# Generate documentation
php artisan scribe:generate

# View in browser
open docs/api.html
```

The generated PHPDoc is 100% compatible with Scribe's expectations!

Performance
-----------

[](#performance)

- **Single controller:** ~50ms
- **10 controllers:** ~500ms
- **50+ controllers:** &lt;5 seconds

Uses pure PHP Reflection - no external API calls or network requests.

Complexity Scoring
------------------

[](#complexity-scoring)

Methods are scored 1-30 based on:

- Lines of code
- Nesting levels
- Database transactions
- Queue jobs
- Authorization checks
- Validation logic
- Exception handling
- Relation operations

Methods scoring below threshold are skipped (use `--force` to include).

Troubleshooting
---------------

[](#troubleshooting)

### Q: Command not found?

[](#q-command-not-found)

**A:** Reinstall composer files:

```
composer dump-autoload
```

### Q: No controllers found?

[](#q-no-controllers-found)

**A:** Make sure controllers exist in `app/Http/Controllers/` and filename matches class name.

### Q: Method not being documented?

[](#q-method-not-being-documented)

**A:** Check:

1. Method is public
2. Not a magic method (\_\_construct, etc)
3. Not in excluded list (config)
4. Complexity &gt; 5 (use --force to include simple)

### Q: Want specific method only?

[](#q-want-specific-method-only)

**A:** Use --method option:

```
php artisan generate:controller-docs OrderController --method=store
```

File Structure
--------------

[](#file-structure)

```
src/
├── ControllerDocBlockGenerator.php       (Core logic - 95% pattern coverage)
├── ControllerPhpDocGeneratorServiceProvider.php
└── Commands/
    └── GenerateControllerDocsCommand.php (Artisan command with controller/method support)

config/
└── phpdoc-generator.php                  (Configuration)

```

What Gets Generated
-------------------

[](#what-gets-generated)

For each method, you get:

✅ **Intelligent Description**

- Based on method name and code analysis
- Natural language
- Contextual details

✅ **Parameter Documentation**

- `@bodyParam` for FormRequest inputs
- `@urlParam` for route parameters
- Validation rules as constraints
- Realistic examples

✅ **Response Examples**

- Success response (200, 201, 204)
- Validation errors (422)
- Authorization errors (403)
- Rate limit errors (429)
- Custom exceptions (400, 402, 409, etc)

✅ **Implementation Notes**

- Transaction behavior
- Async operations
- Caching behavior
- Authorization requirements
- Rate limiting info
- Soft delete support

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10+ or 11+

License
-------

[](#license)

MIT

---

**Never write PHPDoc manually again! 🎉**

For support or issues: [GitHub Issues](https://github.com/badass-dd/lazy-docs)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance79

Regular maintenance activity

Popularity1

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.8% of commits — single point of failure

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

116d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/963384418bc66ecf1220461c65987147eb97bc903edc5594e78ec146a35041fa?d=identicon)[axelbad](/maintainers/axelbad)

---

Top Contributors

[![4ssurd4](https://avatars.githubusercontent.com/u/216015899?v=4)](https://github.com/4ssurd4 "4ssurd4 (7 commits)")[![axelbad](https://avatars.githubusercontent.com/u/8598461?v=4)](https://github.com/axelbad "axelbad (5 commits)")[![axelbad-NetMedica](https://avatars.githubusercontent.com/u/206683576?v=4)](https://github.com/axelbad-NetMedica "axelbad-NetMedica (1 commits)")

### Embed Badge

![Health badge](/badges/badass-dd-lazy-docs/health.svg)

```
[![Health](https://phpackages.com/badges/badass-dd-lazy-docs/health.svg)](https://phpackages.com/packages/badass-dd-lazy-docs)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[pulkitjalan/ip-geolocation

IP Geolocation Wrapper with Laravel Support

89164.9k1](/packages/pulkitjalan-ip-geolocation)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)

PHPackages © 2026

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