nickwelsh / laravel-fumadocs
Generate Fumadocs documentation and PHP API references for Laravel applications and packages.
Requires
- php: ^8.2
- illuminate/console: ^11.0|^12.0|^13.0
- illuminate/contracts: ^11.0|^12.0|^13.0
- illuminate/filesystem: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- nikic/php-parser: ^5.6
- symfony/finder: ^7.0|^8.0
- symfony/process: ^7.0|^8.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.24
- mockery/mockery: ^1.6
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^3.8|^4.0
- pestphp/pest-plugin-arch: ^3.1|^4.0
This package is auto-updated.
Last update: 2026-07-24 00:42:54 UTC
README
Generate a complete Fumadocs site plus PHP API reference from a Laravel app or package.
Install
composer require --dev nickwelsh/laravel-fumadocs php artisan vendor:publish --tag=fumadocs-config php artisan fumadocs:generate
First run asks for a framework, invokes the official Fumadocs creator, installs dependencies, integrates Laravel Fumadocs, then generates the API reference. Supported frameworks:
- Next.js
- Astro with React
- Waku
- React Router
- TanStack Start
For noninteractive setup:
php artisan fumadocs:generate --framework=astro
The selected framework is persisted in docs/.fumadocs/framework.json.
The generated site has its own package.json; the Laravel project's frontend
dependencies stay untouched.
Content
docs/content/docs/
├── guide/ # handwritten; never removed by generation
├── api/ # generated PHP reference
└── openapi/ # generated HTTP API reference when enabled
Root folders use Fumadocs layout tabs. PHP generation owns only files listed in
docs/.fumadocs/generated.json; stale owned files are removed safely.
The analyzer reads source without executing it. It documents classes,
interfaces, traits, enums, functions, inheritance, traits, attributes,
constants, properties, methods, parameters, native types, defaults, source
locations, and useful PHPDoc tags. Configure public/protected/private and
@internal handling in config/fumadocs.php.
Smart API links
Use a fully qualified PHP symbol in any handwritten MDX page:
<ApiLink symbol="Illuminate\Support\Collection" />
The generated api-symbols.json manifest resolves it to the current API URL.
PHP integrations can inject LaravelFumadocs\Links\ApiLinkResolver.
OpenAPI
Enable it and provide one or more JSON/YAML specs:
'openapi' => [ 'enabled' => true, 'specs' => [ base_path('openapi.json'), ], 'directory' => 'content/docs/openapi', ],
With no explicit spec, conventional locations such as openapi.json,
openapi.yaml, and storage/api-docs/api-docs.json are detected. Generated
pages use Fumadocs OpenAPI with statically bundled schemas, so all five
frameworks work without framework-specific server preloading.
Commands
php artisan fumadocs:install php artisan fumadocs:generate
Useful options:
--framework=next|astro|waku|react-router|tanstack-start
--no-dependencies
--no-openapi
--force-setup
Run the site:
cd docs
npm run dev
Change node.package_manager to pnpm, yarn, or bun when preferred.
Current Fumadocs apps require Node.js 22 or newer.
Why PHP-Parser
nikic/php-parser provides deterministic, source-only PHP API extraction with
resolved names and accurate locations. Laravel Ranger targets runtime Laravel
components such as routes, models, validation, events, and Inertia data. It is
beta and not required for class-reference generation; a future optional
enricher can add that application-specific layer without coupling the core
index to Ranger's changing API.
Development
composer test
composer analyse
composer format:test
PHPStan/Larastan runs at level 10. Tests use Pest. Formatting uses Pint.