1. Go to this page and download the library: Download tsitsishvili/documentator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tsitsishvili / documentator example snippets
/**
* Create an order.
*
* Charges the customer and returns the created order. This summary and
* description are read straight from the docblock — no attributes needed.
*/
public function store(StoreOrderRequest $request): OrderResource
{
// Inferred with no attributes: path param {order}, body params from
// StoreOrderRequest::rules(), a 201 response from OrderResource.
return new OrderResource(Order::create($request->validated()));
}
public function store(CreateOrderData $data): OrderData
{
// body params from CreateOrderData's typed properties; 201 response from OrderData
return OrderData::from(Order::create($data->toArray()));
}
use Tsitsishvili\Documentator\Attributes\{Summary, Description, Group, BodyParam, HeaderParam, CookieParam, Response, ResponseHeader, RequestMediaType, OperationId, Server, Authenticated};
#[Group('Orders')]
#[OperationId('createOrder')]
#[Server('https://tenant.example.com', description: 'Tenant API')]
#[Summary('Create an order')]
#[Description('Creates an order for the authenticated customer.')]
#[Authenticated]
#[HeaderParam('X-Tenant', errors: array<string, list<string>>}')]
public function store(StoreOrderRequest $request): OrderResource
{
// ...
}
#[Group('Products', version: 'v2')]
final class ProductController
{
// ...
}
$request->validate([
/**
* Literal API key. The escaped dot stays part of the field name.
*
* @var uuid
* @example 9f40d932-c4c0-4a36-9fb5-10d18c2a1f61
* @default 9f40d932-c4c0-4a36-9fb5-10d18c2a1f61
*/
'user\.uuid' => ['