PHP code example of hecsedli / cakephpjsonrpcserver

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

    

hecsedli / cakephpjsonrpcserver example snippets


// config/bootstrap.php

Plugin::load('JSONRPCServer', ['bootstrap' => true]);

public $components = ["JSONRPCServer.JsonrpcServer"];

public function user($request) {
	if (isset($request->params->userId)) {
		return $this->User->findById($request->params->userId);
	} else {
		throw new Exception('No user ID was specified', 123);
	}
);