PHP code example of basilicom / rpc-gateway
1. Go to this page and download the library: Download basilicom/rpc-gateway 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/ */
basilicom / rpc-gateway example snippets
$rpc = new \RpcGateway\Gateway();
$rpc->setServiceClassNamespace('\Website\Rpc\Custom\\');
use Pimcore\Config;
class RpcController extends \Website\Controller\Action
{
/**
* @return void
*/
public function defaultAction()
{
$this->disableViewAutoRender();
try {
$gateway = new \RpcGateway\Gateway();
$gateway->setServiceClassNamespace('\Website\App\Rpc\Service\\');
$gateway->setRequest($this->getRequest());
$gateway->setResponse($this->getResponse());
$gateway->dispatch();
} catch (\Exception $e) {
if (Config::getSystemConfig()->get('general')->debug) {
var_dump($e);
exit;
} else {
echo "NO METHOD";
die();
}
}
}
}