1. Go to this page and download the library: Download garlic/bus 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/ */
garlic / bus example snippets
$data = $this->get('communicator') // Or you can call by class name. Example: $this->get(GarlicBus:class)
->request('targetServiceName') // Type of message. So far you can use ->request() or ->command() methods. Command provide mesage type that not need response.
->post() // Set one of REST methods (post, put, delete). Bu default set GET
->targetServiceAction( // CamelCased route where slashes vere changed to upper letter by magic (example: getUser will changed to /get/user)
array $path = [], // Path parameters to query (example: ['user' => 1])
array $query = [], // Post or Get parameters to the query
array $headers = [] // Additional headers
);
$data = $this->get('communicator')
->request('targetServiceName')
->send(
string $route, // Route to the target service action (example: /user/get)
array $path = [],
array $query = [],
array $headers = []
);
$data = $this->get('communicator')
->pool(
'service1', // Target service name
'/', // Route to the target service action (example: /user/get)
[], // Path parameters to query
[], // Post or Get parameters to the query
[] // Request headers
)
->pool(
'service1', // Target service name
'/', // Route to the target service action (example: /user/get)
[], // Path parameters to query
[], // Post or Get parameters to the query
[] // Request headers
)
->fetch(); // Get response from async queries pool