Download the PHP package oncesk/yii-node-socket without Composer

On this page you can find all versions of the php package oncesk/yii-node-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 yii-node-socket

Yii Node Socket

Join the chat at https://gitter.im/oncesk/yii-node-socket

Connect php, javascript, nodejs in one Yii application.

Yii1

Hi, if you need work with yii1 you can do it from (https://github.com/oncesk/yii-node-socket/tree/2.0.0)

What you can do:

Changes

Requirements

Installation

Install nodejs, if not installed see http://nodejs.org/
Install extension

Now go to the folder where you install extension application.ext.yii-node-socket and execute

Yii configuration

Notice: host should be a domain name like in you virtual host configuration or server ip address if you request page using ip address

Notice: if you will be use behaviors or node-socket models, you need to add nodeSocket component in preload components list

Install nodejs components in application.ext.yii-node-socket.lib.js.server:

If you get errors issuing this command try the following:

Congratulation, installation completed!

Notice: if the name of the component will not be nodeSocket, your need to use special key in console command --componentName=component_name

Console command actions

Use (./yiic node-socket)

Definitions

Javascript

Before use in javascript, register client stripts like here Depricated in Yii 2.0 - The Asset Manager registers the files on demand.

Events

Work in javascript

Use YiiNodeSocket class

Start work

Catch Events

Now events can be created only on PHP side. All data transmitted in json format. Into callback function data was pasted as javascript native object (or string, integer, depends of your PHP Frame config)

Rooms

Channels

Channel is very similar to the room, but you can controll access to channel for clients

Emit events

You can emit event to:

Global events:

Room event:

Shared Public Data

You can set shared data only from PHP using PublicData Frame (see below into PHP section). To access data you can use getPublicData(string key, callback fn) method

PHP

Behaviors

Client authorization

For authorizing client you need send special Authentication frame, you can do it in your user component in afterLogin event

After that, this user can receive events only for him. See example below, send event only for single (concrete) $user

and your javascript

Client scripts registration

Event frame

Set up shared data

You can set expiration using setLifeTime(integer $lifetime) method of class PublicData

Room events

Only member of testRoom can catch this event

Invoke client function or method

In your PHP application you can invoke javascript function or method of object in window context.

Extends from Event frame => you can send it into specific room

DOM manipulations with jquery

Task: you need update price on client side after price update in each product

Send more than one frame per a time

Example 1:

Example 2:

PS

Sorry for my english :)


All versions of yii-node-socket with dependencies

PHP Build Version
Package Version
Requires oncesk/elephant.io Version dev-master
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 oncesk/yii-node-socket contains the following files

Loading the files please wait ....