PHP Classes

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

Recommend this page to a friend!

  Author Author  
Picture of Till Wehowski
Name: Till Wehowski <contact>
Classes: 27 packages by
Country: Germany Germany
Innovation award
Innovation award
Nominee: 9x


  Detailed description   Download Download .zip .tar.gz  
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.

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);

  Classes of Till Wehowski  >  PHP JSON RPC Discoverable Server  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP JSON RPC Discoverable Server
Base name: json-rpc-server-dico
Description: Implements a JSON RPC server that is discoverable
Version: -
PHP version: 5
License: MIT/X Consortium License
 
  Groups   Applications   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Web services Web data clipping, SOAP or XML-RPC clients and servers View top rated classes


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  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

Download Download all files: json-rpc-server-dico.tar.gz json-rpc-server-dico.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
For more information send a message to info at phpclasses dot org.