Download the PHP package operation-hardcode/php-rpc-server without Composer

On this page you can find all versions of the php package operation-hardcode/php-rpc-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-rpc-server

test Codecov Total Downloads

JSON RPC Server implementation for PHP.

The json-rpc is a very simple protocol. You can see this by reading the protocol specification.

This library implements json-rpc server specification. It is easy to use and well typed.

Contents

Installation

Usage

Since the json-rpc server has only one endpoint, you need a handler that knows how to determine from the name of the method the handler that you will handle the request. You can write it yourself, if the OperationHardcode\PhpRpcServer\RpcHandler interface is implemented. Or use the ready-made one that comes with the library, the OperationHardcode\PhpRpcServer\InvokableRpcHandler.

To start to use the rpc server, instantiate the RpcServer:

The rpc-server does not fetch the json, it just processes it according to the specification. This gives you the freedom to use the server, because you can pass the json fetched any way you know: via http, web sockets or even via tcp.

As you may have noticed, handlers may not have an RpcResponse object. If so, it is a notification, not a request, so no response to the client will follow. You can simply return this object (because it is null) or null directly.

The rpc-server uses validators to validate json against the specification. If you want to add your own validators, you must implement the OperationHardcode\PhpRpcServer\Protocol\Validation\ValidateRequest interface. In the validate method you will get the raw payload to ensure it satisfy your extended protocol rules.

If your validator fails, the error INVALID_REQUEST will be returned to the client.

If you are not satisfied with the standard request handler, you can write your own.

Examples

More extensive code examples reside in the examples directory.

Testing

Stat Analysis

License

The MIT License (MIT). See License File for more information.


All versions of php-rpc-server with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
psr/log Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package operation-hardcode/php-rpc-server contains the following files

Loading the files please wait ....