oploshka/rpc-core

1.0.0 2020-08-13 20:03 UTC

This package is auto-updated.

Last update: 2024-04-22 00:06:35 UTC


README

1.Installation

The recommended way to install is through Composer. Run the following command to install it:

php composer.phar require oploshka/rpc-core

2. Features

Simplicity

  • simple implementations are available out of the box.

Scalability

  • Ability to write your own processing.
  • Possibility to combine your own and built-in solutions
  • Possibility of step-by-step override.

3. Usage

Sample code:

$MethodStorage  = new \Oploshka\Rpc\MethodStorage();

$MethodStorage->add('TestMethod1', '\\RpcMethodPath\\TestMethod1');
$MethodStorage->add('TestMethod2', '\\RpcMethodPath\\TestMethod2');

// init MultipartJsonRpc_v0_1
$rpcInitData = [
  'methodStorage'   => $MethodStorage                                           ,
  'reform'          => new \Oploshka\Reform\ReformDebug()                            ,
  'dataLoader'      => new \Oploshka\RpcDataLoader\PostMultipartFieldJson()     ,
  'dataFormatter'   => new \Oploshka\RpcDataFormatter\MultipartJsonRpc_v0_1()   ,
  'returnFormatter' => new \Oploshka\RpcReturnFormatter\MultipartJsonRpc_v0_1() ,
  'responseClass'   => new \Oploshka\Rpc\Response()                             ,
];
$Rpc = new \Oploshka\Rpc\Core($rpcInitData);
$Rpc->applyHeaderSettings();
$Rpc->applyPhpSettings();

$returnJson = $Rpc->startProcessingRequest();

echo $returnJson;

More info in docs

4. Testing

Testing has been done using PHPUnit. Code has been tested to be PHP 7.0.

5. Author

Andrey Tyurin

6. Special Thanks

I would like to thank all the people who know me and surround me.

7. License

"Rpc-core" is licensed under the MIT license.

Copyright (c) 2018 Andrey Tyurin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.