PHP code example of yoanm / symfony-jsonrpc-http-server
1. Go to this page and download the library: Download yoanm/symfony-jsonrpc-http-server 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/ */
yoanm / symfony-jsonrpc-http-server example snippets
// config/bundles.php
return [
...
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Yoanm\SymfonyJsonRpcHttpServer\JsonRpcHttpServerBundle::class => ['all' => true],
...
];
use Yoanm\JsonRpcServer\Domain\JsonRpcMethodAwareInterface;
use Yoanm\JsonRpcServer\Domain\JsonRpcMethodInterface;
class MappingCollector implements JsonRpcMethodAwareInterface
{
/** @var JsonRpcMethodInterface[] */
private $mappingList = [];
public function addJsonRpcMethod(string $methodName, JsonRpcMethodInterface $method): void
{
$this->mappingList[$methodName] = $method;
}
/**
* @return JsonRpcMethodInterface[]
*/
public function getMappingList() : array
{
return $this->mappingList;
}
}