- How do I install and generate API docs for my Laravel app with Scribe?
- Install via Composer with `composer require knuckleswtf/scribe`, then run `php artisan scribe:generate` in your project root. This scans your Laravel routes, validation, and resources to auto-generate docs. No extra configuration is needed for basic usage.
- Does Scribe support Laravel 13 and PHP 8.4?
- Yes, Scribe officially supports Laravel 10–13 and PHP 8.1–8.4 as of version 5.10.0. Check the [release notes](https://github.com/knuckleswtf/scribe/releases) for version-specific compatibility details if you’re using an older Laravel version.
- Can Scribe extract request parameters from FormRequests and validation rules?
- Absolutely. Scribe automatically parses FormRequests and validation rules (including nested arrays, nullable fields, and custom rules) to generate accurate request parameter documentation. This eliminates manual documentation for most Laravel APIs.
- How does Scribe handle sample responses for API endpoints?
- Scribe can call your API endpoints during generation to fetch live sample responses. For Eloquent API Resources or Transformers, it generates responses statically. Use `--test` mode to avoid live calls or mock dependencies during generation.
- Is it possible to customize the generated API documentation UI or content?
- Yes, Scribe is highly customizable. You can adjust text, reorder endpoints, modify examples, or even override the UI via Blade templates in the config. For advanced use cases, you can extend extraction logic with custom strategies.
- Does Scribe generate OpenAPI specs or Postman collections?
- Yes, Scribe outputs OpenAPI 3.0.3 or 3.1.0 specs and Postman collections alongside the HTML docs. These can be imported into tools like Swagger UI, Postman, or API gateways. The OpenAPI version is configurable in the Scribe config.
- What if Scribe misses some endpoints or misinterprets validation logic?
- Scribe may struggle with dynamic validation (e.g., rules that change based on input) or non-standard routes. To fix this, use `#[Deprecated]` annotations or custom strategies to override extraction. Always validate generated docs against a subset of endpoints post-generation.
- Can I integrate Scribe into my CI/CD pipeline for automated doc generation?
- Yes, you can automate doc generation by adding `php artisan scribe:generate` to your CI pipeline. For production, consider caching generated docs in storage to avoid regenerating on every deploy. Use `--test` mode to skip live endpoint calls if needed.
- Are there alternatives to Scribe for Laravel API documentation?
- Alternatives include Laravel’s built-in `php artisan l5-swagger:generate` (for Swagger/OpenAPI), or manual tools like Swagger UI with handwritten specs. However, Scribe stands out by deeply integrating with Laravel’s validation, FormRequests, and API Resources, reducing manual effort.
- How do I handle endpoints that require database connections or external APIs during doc generation?
- Use factories or mock clients to simulate external services, or temporarily enable database connections during generation. For large APIs, exclude non-critical endpoints via the `ignore_routes` config or use `--test` mode to skip live calls entirely.