PHP code example of psx / asyncapi

1. Go to this page and download the library: Download psx/asyncapi 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/ */

    

psx / asyncapi example snippets


$info = new Info();
$info->setTitle('Account Service');
$info->setVersion('1.0.0');
$info->setDescription('This service is in charge of processing user signups :rocket:');

$message = new Message();
$message->setPayload(Record::fromArray(['$ref' => '#/components/schemas/Pet']));

$http = new HttpOperationBinding();
$http->setType('request');
$http->setMethod('POST');

$bindings = new OperationBindings();
$bindings->setHttp($http);

$operation = new Operation();
$operation->setMessage($message);
$operation->setBindings($bindings);

$channel = new Channel();
$channel->setPublish($operation);

$channels = new Channels();
$channels->put('user/signedup', $channel);

$schemas = new Schemas();
$schemas->put('Pet', [
    '