PHP code example of ufo-tech / json-rpc-sdk-bundle
1. Go to this page and download the library: Download ufo-tech/json-rpc-sdk-bundle 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/ */
/**
* Auto generated SDK class for easy usage RPC API Test
* @link http://nginx/rpc
* Created at 23.07.2023 20:59:37
*
* @category ufo-tech
* @package json-rpc-client-sdk
* @generated ufo-tech/json-rpc-client-sdk
* @author Alex Maystrenko
<[email protected]>
* @see https://ufo-tech.github.io/json-rpc-client-sdk/ Library documentation
* @license https://github.com/ufo-tech/json-rpc-client-sdk/blob/main/LICENSE
*/
namespace App\Sdk\Test;
use Ufo\RpcSdk\Interfaces\ISdkMethodClass;
use Ufo\RpcSdk\Procedures\AbstractProcedure;
use Ufo\RpcSdk\Procedures\ApiMethod;
use Ufo\RpcSdk\Procedures\ApiUrl;
use Ufo\RpcObject\RpcResponse;
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
/**
* RPC API Test
* @link http://nginx/rpc
*/
#[ApiUrl('http://nginx/rpc')]
#[AutoconfigureTag('ufo.sdk_method_class')]
class PingProcedure extends AbstractProcedure implements ISdkMethodClass
{
/**
* @method PingProcedure.ping
* @return string
*/
#[ApiMethod('PingProcedure.ping')]
public function ping(): string
{
return $this->requestApi()->getResult();
}
}
namespace App\Controller;
use App\Sdk\Test\PingProcedure;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
#[Route('/test', name: 'test')]
public function indexAction(PingProcedure $procedure): Response
{
$response = $procedure->ping();
return new Response($response);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.