1. Go to this page and download the library: Download marein/php-nchan-client 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/ */
marein / php-nchan-client example snippets
namespace {
use Marein\Nchan\Api\Model\PlainTextMessage;
use Marein\Nchan\Nchan;
int');
$channelInformation = $channel->publish(
new PlainTextMessage(
'my-message-name',
'my message content'
)
);
// Nchan returns some channel information after publishing a message.
var_dump($channelInformation);
}
namespace {
use Marein\Nchan\Nchan;
channel = $nchan->channel('/path-to-publisher-endpoint');
$channel->delete();
}
namespace {
use Marein\Nchan\Nchan;
status = $nchan->status('/path-to-status-location');
$statusInformation = $status->information();
var_dump($statusInformation);
}
namespace {
use Marein\Nchan\HttpAdapter\BasicAuthenticationCredentials;
use Marein\Nchan\HttpAdapter\BearerAuthenticationCredentials;
use Marein\Nchan\HttpAdapter\HttpStreamWrapperClient;
use Marein\Nchan\Nchan;
new BearerAuthenticationCredentials('my-token')
);
$nchan = new Nchan('http://my-nchan-domain', $adapter);
}
namespace {
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\HttpFactory;
use Marein\Nchan\HttpAdapter\Psr18ClientAdapter;
use Marein\Nchan\Nchan;
tory()
)
);
}
namespace {
use Marein\Nchan\HttpAdapter\Psr18ClientAdapter;
use Marein\Nchan\Nchan;
use Nyholm\Psr7\Factory\Psr17Factory;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\HttpClient\Psr18Client;
n',
new Psr18ClientAdapter(
$httpClient,
$httpClient,
$httpClient
)
);
}
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.