PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 29 All time: 11,143 This week: 524Up
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: 30 packages by
Country: Germany Germany
Age: 45
All time rank: 107269 in Germany Germany
Week rank: 49 Up3 in Germany Germany Up
Innovation award
Innovation award
Nominee: 12x

Documentation

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 (8)  
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 (8)  /  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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:29
This week:0
All time:11,143
This week:524Up