A Laravel package for generating OpenAPI documentation and TypeScript SDK.
ismayil-dev/api-doc-kit is a Laravel package for a laravel package for generating openapi documentation and typescript sdk..
It currently has 4 GitHub stars and 350 downloads on Packagist (latest version v0.4.5).
Install it with composer require ismayil-dev/api-doc-kit.
Discover more Laravel packages by ismayil-dev
or browse all Laravel packages to compare alternatives.
Last updated
API Doc Kit is a developer-friendly package designed to simplify API documentation for Laravel projects. It automates the generation of robust OpenAPI documentation while allowing developers to retain flexibility and control. This package reduces the repetitive effort of manually defining API specs, making the process intuitive, maintainable, and efficient.
| Feature | Description | Status |
|--------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|------------|
| Semi-Automated Documentation | Leverages PHP attributes to generate OpenAPI documentation with minimal configuration. | ✅ Available |
| Model-Aware Operations | Automatically associates routes and parameters with Eloquent models for intelligent documentation generation. | ✅ Available |
| Flexible Parameter Management | Detects route parameters, automatically assigns types, and generates descriptions with the ability to override globally. | ✅ Available |
| Request & Response Handling | Automates OpenAPI property definitions for request classes and resource responses based on rules and model attributes. Detects file-upload rules and emits multipart/form-data bodies (format: binary); see Request Bodies. | ✅ Available |
| Built-in Validation | Ensures all controllers, request classes, and responses adhere to defined documentation rules and highlights discrepancies.| ✅ Available |
| SDK Generation | Generates TypeScript SDKs for front-end integration, including prebuilt methods for API calls (e.g., createUser()). | 🚀 Coming Soon |
| Predefined Responses | Comes with customizable default responses like ValidationError, Unauthorized, and more. | ✅ Available |
| Customizable Workflow | Supports custom route discovery, parameter overrides, and developer-defined extensions for unique project needs. | ✅ Available |
| Global Configuration | Offers configuration for overriding parameter definitions, request behavior, and other package behavior. | ✅ Available |
| CLI Warnings and Reports | Highlights issues like undefined parameters or missing descriptions directly in the CLI. | ✅ Available |
⚠️ This package is currently in active development and NOT production-ready.
Install via Composer:
composer require ismayil-dev/api-doc-kit:dev-main
Publish the config file:
php artisan vendor:publish --tag=api-doc-kit-config
Development Notice: This is an MVP release for testing and gathering feedback. APIs and features may change significantly. Use in production at your own risk.
use IsmayilDev\ApiDocKit\Attributes\Resources\ApiEndpoint;
use IsmayilDev\ApiDocKit\Http\Responses\Contracts\CollectionResponse;
use IsmayilDev\ApiDocKit\Http\Responses\Contracts\SingleResourceResponse;
class UserController extends Controller
{
#[ApiEndpoint(entity: User::class)]
public function index(): CollectionResponse
{
return new ResourceResponse(User::all());
}
#[ApiEndpoint(entity: User::class)]
public function show(User $user): SingleResourceResponse
{
return new ResourceResponse($user);
}
}
php artisan doc:generate
Your OpenAPI YAML will be at storage/app/documentation/openapi.yaml
Import this into Swagger UI, Postman, or any OpenAPI-compatible tool.
This MVP release includes:
php artisan doc:generate#[ApiEndpoint], #[DataSchema], #[Enum] attributesFeatures in active development:
Detailed guides for advanced features:
operationId is derived from controllersMore documentation coming soon as features are added!
API Doc Kit uses a combination of PHP attributes and smart defaults to document your API. Developers can define documentation attributes directly in controllers, request classes, and resources, while the package handles the heavy lifting.
Contributions are welcome! If you have ideas, bug reports, or feature requests, feel free to open an issue or submit a pull request.
Laravel Doc Kit is open-source software licensed under the MIT license.