/epp-rabbitmq-connection

Connection for communicating with EPP(Extensible Provisioning Protocol) servers via RabbitMQ server.

Primary LanguagePHPMIT LicenseMIT

EPP RabbitMQ Connection

Latest Stable Version Total Downloads Software License StandWithUkraine

Connection for communicating with EPP(Extensible Provisioning Protocol) servers via RabbitMQ server.

Connection for struzik-vladislav/epp-client library.

Usage

<?php

use PhpAmqpLib\Connection\AMQPStreamConnection;
use Psr\Log\NullLogger;
use Struzik\EPPClient\EPPClient;
use Struzik\EPPClient\NamespaceCollection;
use Struzik\EPPClient\RabbitMQConnection\RabbitMQConnection;
use Struzik\EPPClient\Request\Domain\CheckDomainRequest;
use Struzik\EPPClient\Response\Domain\CheckDomainResponse;

require_once __DIR__.'/vendor/autoload.php';

$rabbitConnection = new AMQPStreamConnection('localhost', 5672, 'guest', 'guest');
$eppConnection = new RabbitMQConnection($rabbitConnection, 'epp.registry', 30, new NullLogger());
$eppClient = new EPPClient($eppConnection, new NullLogger());
$eppClient->getNamespaceCollection()->offsetSet(NamespaceCollection::NS_NAME_ROOT, 'urn:ietf:params:xml:ns:epp-1.0');
$eppClient->getNamespaceCollection()->offsetSet(NamespaceCollection::NS_NAME_CONTACT, 'urn:ietf:params:xml:ns:contact-1.0');
$eppClient->getNamespaceCollection()->offsetSet(NamespaceCollection::NS_NAME_HOST, 'urn:ietf:params:xml:ns:host-1.0');
$eppClient->getNamespaceCollection()->offsetSet(NamespaceCollection::NS_NAME_DOMAIN, 'urn:ietf:params:xml:ns:domain-1.0');

$eppClient->connect();

$request = new CheckDomainRequest($eppClient);
$request->addDomain('example.com');
/** @var CheckDomainResponse $response */
$response = $eppClient->send($request);

$eppClient->disconnect();