Download the PHP package cydrickn/swoole-websocket-bundle without Composer

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

Swoole Websocket Bundle

A bundle for websocket using swoole

Requirements

Intallation

Add the package

Run the server

Commands

websocket:server

Run the websocket server

Options Details Default
host The host of the server 127.0.0.1
port The port of the server 8000

Events

This bundle will have an event where you can listen

\Cydrickn\SwooleWebsocketBundle\Event\OpenEvent

This event will be trigger once a client have been connected to the server.

\Cydrickn\SwooleWebsocketBundle\Event\MessageEvent

This event will be trigger once the client send a message

\Cydrickn\SwooleWebsocketBundle\Event\CloseEvent

This event will be trigger once a client have been disconnected

Client connection using Javascript

For the basic way on connecting to websocket you can use the Browser Websocket

Use it in runtime

Using the command is fine, but if you happen you want to serve this using symfony runtime you can do so.

  1. First you need to include symfony/runtime

  2. Next run your public/index.php with env APP_RUNTIME

Runtime Configuration

For runtime configuration you can add it to your public/index.php

Key Details Default
host The host of the server 127.0.0.1
port The port of the server 8000
mode The mode for server 2 / SWOOLE_PROCESS
sock_type The socket type for server 1 / SWOOLE_SOCK_TCP
settings The setting is base on swoole configuration [] / Empty Array
serve_http Include to serve HTTP false

Example:

Also instead of having to server for websocket and http, you can just enable the Serve HTTP, by setting the serve_http to true

Hot reloading

We already include a hor reloading for this bundle. To enable it you need to first require cydrickn/php-watcher

Hot reloading is only available if you are using runtime

Now add to your APP_RUNTIME_OPTIONS the hotReload The basePath should be your project folder

Socket IO

In this bundle you can also enable using socket.io implementation, to enable it first you need to install cydrickn/socketio

This implementation is only available if you are using runtime

Now add to your APP_RUNTIME_OPTIONS set the socketio to true

Adding a route to socket io

For pure socket io you will do this

You will use the Attribute Route of this bundle Cydrickn\SwooleWebsocketBundle\Attribute\RouteAttribute In any of your service

Related Package


All versions of swoole-websocket-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
symfony/framework-bundle Version ^6.1
symfony/console Version ^6.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 cydrickn/swoole-websocket-bundle contains the following files

Loading the files please wait ....