Download the PHP package dustinfog/parpc without Composer

On this page you can find all versions of the php package dustinfog/parpc. 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 parpc

ParallelRPC

一个可并发的基于PHP的rpc框架,支持并发请求,所以除了可用于远程调用外,亦可用于一些耗时运算的本地并发,实现类似多线程的效果。

安装

基本环境

服务端

文件命名为rpcrouter.php

可执行php -S 127.0.0.1:9000 rpcrouter.php测试

客户端

普通函数

服务端定义

客户端调用

面向对象

服务端定义类型

客户端调用

可对比本地调用,代码非常接近

Tips 1:

在代码中增加注释可让IDE帮助我们更方便的编写、调试代码,也可消除PHPMD、PHPcs的警告

异常处理

可在客户端测试如下代码:

Tips:

服务端的任何标准异常都会经由RemoteException包装后,传输到客户端。

并发访问

服务端没有变化,客户端与同步访问略有不同,因是异步处理,所以采用回调的方式处理,涉及到的全部源码如下:

Tips 2:

虽然链式风格很吸引人,但如前面tips所述,在代码中增加注释可让IDE帮助我们更方便的调试代码

Tips 3:

onSuccess、onFail、onComplete可叠加使用(如调用两次或以上onSuccess),新的句柄会追加在旧的句柄之后,事件发生后会依次执行。

安全校验

在服务端加入如下代码:

可实现\Parpc\SecurityValidator接口,根据自己需求自定义安全控制

tips 4:

原则上,该框架可以调用远程环境中定义的任意函数或者对象方法,所以完全不加安全控制将会非常危险。

如只是系统内部的调用,只允许127.0.0.1访问是优先考虑的选择,如外部调用,推荐的做法是只暴露一个或几个有限的类或方法,可通过自定义SecurityValidator实现。


All versions of parpc with dependencies

PHP Build Version
Package Version
No informations.
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 dustinfog/parpc contains the following files

Loading the files please wait ....