PHP code example of viloveul / transport

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

    

viloveul / transport example snippets




$bus = new Viloveul\Transport\Bus();
$bus->initialize();
$bus->addConnection('amqp://localhost:5672//');

use Viloveul\Transport\Passenger;

class TaskPassenger extends Passenger
{
	public function point(): string
	{
		return 'exchange name';
	}

	public function route(): string
	{
		return 'routing.key';
	}

	public function data(): string
	{
		return 'string-data';
	}

	public function handle(): void
	{
		$this->setAttribute('data', [
			'foo' => 'bar'
		]);
	}
}

$bus->process(new TaskPassenger);