PHP code example of neznajki / json-rpc-server

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

    

neznajki / json-rpc-server example snippets


class CoolMethod implements MethodHandlerInterface
{
    /**
     * @param string $test
     * @param int|null $test2
     * @return mixed
     */
    public function handle(string $test = null, ?int $test2 = null)
    {
        return $test . 'tt';
    }

    /**
     * @return string
     */
    public function getMethod(): string
    {
        return 'coolMethodIncomingName';
    }

    /**
     * @return array
     */
    public function getRequiredParameters(): array
    {
        return ['test'];
    }
}