Download the PHP package microse/microse-swoole without Composer

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

🌹Microse

Microse (stands for Micro Remote Object Serving Engine) is a light-weight engine that provides applications the ability to serve modules as RPC services, whether in another process or in another machine.

This is the PHP version of the microse implementation based on Swoole. For API reference, please check the API documentation, or the Protocol Reference.

Other implementations:

Install

Peel The Onion

In order to use microse, one must create a root ModuleProxyApp instance, so other files can use it as a root proxy and access its sub-modules.

Example

In other files, just define a class with the same name as the filename, so that another file can access it directly via the $app instance.

Don't forget to augment types in the AppInstance class if you need IDE typing support:

And other files can access to the module as a property:

Remote Service

The above example accesses the module and calls the function in the current process, but we can do more, we can serve the module as a remote service, and calls its functions as remote procedures.

Example

For example, if I want to serve a user service in a different process, I just have to do this:

Just try php server.php and the services will be started immediately.

And in the client-side code, connect to the service before using remote functions.

NOTE: to ship a service in multiple server nodes, just create and connect to multiple channels, and register the service to each of them, when calling remote functions, microse will automatically calculate routes and redirect traffics to them.

NOTE: RPC calling will serialize (via JSON) all input and output data, those data that cannot be serialized will be lost during transmission.

Generator Support

When in the need of transferring large data, generator functions could be a great help, unlike general functions, which may block network traffic when transmitting large data since they send the data as a whole, generator functions, on the other hand, will transfer the data piece by piece.

The generator function returns an rpc version of the Generator, so if you want to send data into the generator, you can use Generator::send() to do so, the value passed to the method will be delivered to the remote instance as well.

Life Cycle Support

Since swoole already handles asynchronous operations under the hood, so lifecycle support is done by the original __construct and __destruct methods, and there is no need for any extra efforts.

Standalone Client

Microse also provides a way to be running as a client-only application, in this case the client will not actually load any modules since there are no such files, instead, it just map the module names so you can use them as usual.

In the following example, we assume that $app->services->user service is served by a Node.js program, and we can use it in our PHP program as usual.

For client-only application, you may need to declare all abstract classes:

Process Interop

This implementation supports interop in the same process, that means, if it detects that the target remote instance is served in the current process, the function will always be called locally and prevent unnecessary network traffic.


All versions of microse-swoole with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-swoole Version >=4.4.0
rowbot/url Version ^3.1
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 microse/microse-swoole contains the following files

Loading the files please wait ....