1. Go to this page and download the library: Download ferror/asyncapi-doc-bundle 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/ */
use Ferror\AsyncapiDocBundle\Attribute\Message;
use Ferror\AsyncapiDocBundle\Attribute\Channel;
#[Message(name: 'ProductCreated')]
#[Channel(name: 'product.created')] // optional
final readonly class ProductCreated
{
public function __construct(
public int $id,
public float $amount,
public string $currency,
public bool $isPaid,
public DateTime $createdAt,
public Week $week,
public Payment $payment,
public array $products,
public array $tags,
) {
}
}
use Ferror\AsyncapiDocBundle\Attribute as AA;
use Ferror\AsyncapiDocBundle\Schema\Format;
use Ferror\AsyncapiDocBundle\Schema\PropertyType;
#[AA\Message(name: 'ProductCreated')]
#[AA\Channel(name: 'product.created')] // optional
final readonly class ProductCreated
{
public function __construct(
#[AA\Property(name: 'id', type: PropertyType::INTEGER)]
public int $id,
#[AA\Property(name: 'amount', type: PropertyType::FLOAT)]
public float $amount,
#[AA\Property(name: 'currency', type: PropertyType::STRING)]
public string $currency,
#[AA\Property(name: 'isPaid', type: PropertyType::BOOLEAN)]
public bool $isPaid,
#[AA\Property(name: 'createdAt', type: PropertyType::STRING, format: Format::DATETIME)]
public DateTime $createdAt,
#[AA\PropertyEnum(name: 'week', enum: Week::class)]
public Week $week,
#[AA\PropertyObject(name: 'payment', class: Payment::class)]
public Payment $payment,
#[AA\PropertyArrayObject(name: 'products', class: Product::class)]
public array $products,
#[AA\PropertyArray(name: 'tags', itemsType: 'string')]
public array $tags,
) {
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.