Laravel2Doc
Automatically generate comprehensive documentation for Laravel applications, including Entity Relationship Diagrams (ERD), UML Class Diagrams, Sequence Diagrams, API Documentation, and more.
Features
- 📊 Entity Relationship Diagrams (ERD): Visual representation of your database schema
- 📝 UML Class Diagrams: Object-oriented view of your models and their relationships
- 🔄 Sequence Diagrams: Flow of interactions between components
- 📚 API Documentation: Comprehensive documentation of your API endpoints
- 🚀 Interactive Interface: Browse all documentation through a user-friendly web interface
- 🔍 Automatic Analysis: No configuration needed - just install and run
Installation
Global Installation
npm install -g @priom7/laravel2doc
Local Installation (within a Laravel project)
cd your-laravel-project
npm install @priom7/laravel2doc
Usage
Within a Laravel Project
Navigate to your Laravel project root directory and run:
npx laravel2doc
This will analyze your Laravel project and generate documentation in the laravel2doc
directory. It will also start a web server to view the documentation.
Options
-p, --port <number>
: Port to serve documentation on (default: 3333)-o, --output <dir>
: Output directory (default: 'laravel2doc')
Demo Mode
If you run Laravel2Doc outside a Laravel project, it will generate example documentation to demonstrate its features:
npx laravel2doc
Generated Documentation
Laravel2Doc generates the following documentation:
Entity Relationship Diagrams (ERD)
- Database tables with columns and data types
- Primary keys and foreign keys
- Relationships between tables
UML Class Diagrams
- Models with properties and methods
- Relationships between models
- Inheritance hierarchies
Sequence Diagrams
- Controller actions and their interactions
- Common operations like create, read, update, delete
- Flow of data between components
API Documentation
- Endpoints with HTTP methods
- Controller handlers and parameters
- Route definitions
How It Works
Laravel2Doc analyzes your Laravel project by:
- Scanning model files to extract relationships and properties
- Analyzing migrations to build database schema
- Parsing controllers to understand application flow
- Examining route files to document API endpoints
- Generating interactive documentation with Mermaid diagrams
Requirements
- Node.js 14+
- Laravel 8+ project (for Laravel-specific documentation)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Created by priom7