PHP Classes

PHP JSON RPC Discoverable Server: Implements a JSON RPC server that is discoverable

Recommend this page to a friend!
  Info   View files Documentation   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-03-23 (6 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 26 All time: 10,658 This week: 165Up
Version License PHP version Categories
json-rpc-server-dico 1.0MIT/X Consortium ...5PHP 5, Web services
Description Author

This package implements a JSON RPC server that is discoverable.

It extends a JSON RPC API server class to add an API function that can return details about the service functionality according to the OpenRPC specification.

This package takes additional configuration that allows defining many types of service configuration details that the API service discovery method returns.

Picture of Till Wehowski
  Performance   Level  
Name: Till Wehowski <contact>
Classes: 28 packages by
Country: Germany Germany
Age: 43
All time rank: 109570 in Germany Germany
Week rank: 57 Up5 in Germany Germany Up
Innovation award
Innovation award
Nominee: 10x

Details

json-rpc-server-dicoverable

extends uma/json-rpc(https://github.com/1ma/JsonRpc)

Added:

* rpc.dicover method

https://spec.open-rpc.org/

* Result validation * Remote schema loader

Example

$payload = '{"jsonrpc":"2.0","method":"rpc.discover","params":[],"id":1}';

// \frdl\i::c() returns an container instance
\frdl\i::c()->set( \webfan\hps\Api\RpcMethod\Test::class, function(\UMA\DIC\Container $c) {
    return new \webfan\hps\Api\RpcMethod\Test();
});		


$config = [
		'schemaLoaderPrefix' => '',
		'schemaLoaderDirs' => [],	
	//	'schemaCacheDir' => __DIR__.\DIRECTORY_SEPARATOR.'schema-store'.\DIRECTORY_SEPARATOR,			
		'schemaCacheDir' => sys_get_temp_dir() . \DIRECTORY_SEPARATOR . get_current_user(). \DIRECTORY_SEPARATOR . 'json-schema-store' . \DIRECTORY_SEPARATOR,
		'discovery' => 	true,
		'meta' => [
		  'openrpc' => '1.0.0-rc1',
		  "info" => [
              "title" => "JSON-RPC Server",
              "description" =>"This the RPC-part of an Frdlweb API Server definition https://look-up.webfan3.de/?goto=oid%3A1.3.6.1.4.1.37553.8.1.8.1.13878",
              "version" => "1.0.0",
          ],
		  'servers' => [
			[
		     'name' => 'Webfan Homepagesystem RPC API',
		     'summary' => 'Webfan Homepagesystem RPC API methods description',
		     'description' => 'This is the RPC part of an implementation of the Frdlweb API Specification (1.3.6.1.4.1.37553.8.1.8.1.13878)',
		     'url' => 'https://'.$_SERVER['SERVER_NAME'].'/software-center/modules-api/rpc/0.0.2/',
		    ]
			  
		  ],
		    'methods' => [],
		    'components' => [
			     'links' => [],
			     'contentDescriptors' => [],
			     'schemas' => [],
			     'examples' => [],
			  
			  ],
		 ],	
		];


	try{	
	    $server = new \frdlweb\Api\Rpc\Server(\frdl\i::c(), 50, $config, true);
		
	    $server->set('test', \webfan\hps\Api\RpcMethod\Test::class);
		
		$response = $server->run($payload);

	}catch(\Exception $e){
	  echo  $e->getMessage();	
	}



  echo print_r($response,true);
  Files folder image Files  
File Role Description
Files folder imagesrc (5 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Accessible without login Plain text file DiscoverMethod.php Class Class source
  Accessible without login Plain text file MetadataException.php Class Class source
  Accessible without login Plain text file MethodDiscoverableInterface.php Class Class source
  Accessible without login Plain text file SchemaLoader.php Class Class source
  Accessible without login Plain text file Server.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:26
This week:0
All time:10,658
This week:165Up
For more information send a message to info at phpclasses dot org.