Download the PHP package brainboxlabs/brain-socket without Composer

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

BrainSocket.php

NOTE: BrainSocket is ideal for heavier front-end development (think single page javascript apps etc). We are currently working on integrating PUSH notifications into the next release.

WebSockets for realtime event-driven Laravel apps.

This Laravel 4 package provides an Artisan command to setup and run a WebSocket server with Ratchet inside of a Laravel app.

Lets begin by installing this package through Composer. Edit your Laravel project's composer.json file and add the require brainboxlabs/brain-socket:

Note: make sure and check packagist.org for updated dependencies but the list above is what has been tested at the time of this writing.

Once the package and all of its dependencies have been installed we need to add the BrainSocketServiceProvider to our app/config/app.php file.

Add this line:

to the end of the providers array in the config file.

There is also an optional but recommended Facade you should add to the aliases array in the app/config/app.php file.

Next open terminal and cd into your Laravel project directory.

run php artisan list and confirm you see the brainsocket: command in the list of commands. It should look like this:

Once you have confirmed the list, run the following command to start the WebSocket server:

Note: The websocket server runs on port 8080 by default. You can change this with the optional --port=port_number on the end of the artisan command.

At this point you should see a message in the terminal saying the websocket has been started on the selected port. Terminal will be locked down / unusable at this point, to stop the WebSocket server hit ctrl+c in the terminal.

Note: Any changes to your laravel app / code while the ws server is running are not taken into account. You need to restart the ws server to see any of your changes.

Lets stop the ws server now by hitting ctrl+c in the terminal.

Next in your app/ folder create a file called events.php

Lets add the following code to events.php:

Note: The $client_data parameter passed into the event listener is a POPO (Plain Old PHP Object) with all of the data passed from the client side.

Note: The app.success and app.error events are not required but are helper events for dealing with flash messaging.

Now in app/start/global.php add the following line at the end of the file:

Great! Now we have a few events to test out on the client side. Run the artisan command php artisan brainsocket:start to start the ws server again.

To make things easier we have created a simple js helper that allows us to interact with our new ws server a bit easier. It's not required but it handles some minor formatting tasks in the background so you don't have to and pairs nicely with our BrainSocket Facade.

Head over to https://github.com/BrainBoxLabs/brain-socket-js to grab it.


All versions of brain-socket with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
cboden/ratchet Version 0.3.*
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 brainboxlabs/brain-socket contains the following files

Loading the files please wait ....