PHP code example of neznajki / json-rpc-client-base

1. Go to this page and download the library: Download neznajki/json-rpc-client-base 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/ */

    

neznajki / json-rpc-client-base example snippets


class TestClient extends AbstractClient
{

    /**
     * @param string $param1
     * @param int $param2
     * @return ResponseEntity
     */
    public function ping(string $param1, int $param2): ResponseEntity
    {
        $request = $this->addPing($param1, $param2);

        return $this->handle()->getResponseById($request->getId());
    }

    /**
     * @param string $param1
     * @param int $param2
     * @return RequestEntity
     */
    protected function addPing(string $param1, int $param2): RequestEntity
    {
        return $this->addRequest(__FUNCTION__, ['param1' => $param1, 'param2' => $param2]);
    }
}