Download the PHP package voryx/thruway-bundle without Composer

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

ThruwayBundle

This a Symfony Bundle for Thruway, which is a php implementation of WAMP (Web Application Messaging Protocol).

Note: This project is still undergoing a lot of changes, so the API will change.

Quick Start with Composer

Install the Thruway Bundle

  $ composer require "voryx/thruway-bundle"

Update AppKernel.php (when using Symfony < 4)

Configuration

With Symfony 4 use a filename like:

If you are using the in-memory user provider, you'll need to add a to the security firewall and set the in_memory_user_provider.

You can also tag services with thruway.resource and any annotation will get picked up

Note: tagging a service as thruway.resource will make it public.

Authentication with FOSUserBundle via WampCRA

Change the Password Encoder (tricky on existing sites) to master wamp challenge

set voryx_thruway.user_provider to "fos_user.user_provider"

The WAMP-CRA service is already configured, we just need to add a tag to it to have the bundle install it:

Custom Authorization Manager

You can set your own Authorization Manager in order to check if a user (identified by its authid) is allowed to publish | subscribe | call | register

Create your Authorization Manager service, extending RouterModuleClient and implementing RealmModuleInterface (see the Thruway doc for details)

Register your authorization manager service

Insert your service name in the voryx_thruway config

Restart the Thruway server; it will now check authorization upon publish | subscribe | call | register. Remember to catch error when you try to subscribe to a topic (or any other action) as it may now be denied and this will be returned as an error.

Usage

Register RPC

Call RPC

Subscribe

Publish

It uses Symfony Serializer, so it can serialize and deserialize Entities

Start the Thruway Process

You can start the default Thruway workers (router and client workers), without any additional configuration.

$ nohup php app/console thruway:process start &

By default, the router starts on ws://127.0.0.1:8080

Workers

The Thruway bundle will start up a separate process for the router and each defined worker. If you haven't defined any workers, all of the annotated calls and subscriptions will be started within the default worker.

There are two main ways to break your application apart into multiple workers.

  1. Use the worker property on the Register and Subscribe annotations. The following RPC will be added to the posts worker.

  2. Use the @Worker annotation on the class. The following annotation will create a worker called chat that can have a max of 5 instances.

If a worker is shut down with anything other than SIGTERM, it will automatically be restarted.

More Commands

To see a list of running processes (workers)
$ php app/console thruway:process status
Stop a process, i.e. default
$ php app/console thruway:process stop default
Start a process, i.e. default
$ php app/console thruway:process start default

Javascript Client

For the client, you can use AutobahnJS or any other WAMPv2 compatible client.

Here are some examples

Symfony 4 Quick Start

Create config/packages/my_project.yml with the following config:

Create the controller src/Controller/TestController.php

Test to see if the RPC has been configured correctly bin/console thruway:debug

For more debug info for the RPC we created: bin/console thruway:debug com.example.add

Start everything: bin/console thruway:process start

The RPC com.example.add is now available to any WAMP client connected to ws://127.0.0.1:8081 on realm1.


All versions of thruway-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
symfony/finder Version ^2.7|^3.0|^4.0
voryx/thruway Version ~0.5
symfony/serializer Version ^2.7|^3.0|^4.0
react/child-process Version ~0.4
symfony/event-dispatcher Version ^2.7|^3.0|^4.0
thruway/pawl-transport Version ^0.5.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 voryx/thruway-bundle contains the following files

Loading the files please wait ....