Download the PHP package nineinchnick/yii2-nfy without Composer

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

Notifications

This is a module for Yii 2.0 framework that provides:

Messages could be passed directly as strings or created from some objects, like Active Records. This could be used to log all changes to the models, exactly like the audittrail2 extension.

When recipients are subscribed to a channel, message delivery can depend on category filtering, much like in logging system provided by the framework.

A simple SQL queue implementation is provided if a MQ server is not available or not necessary.

Installation

  1. Install Yii2 using your preferred method
  2. Install package via composer
    • Run php composer.phar require nineinchnick/yii2-nfy "dev-master" OR add to composer.json require section "nineinchnick/yii2-nfy": "dev-master"
    • If Redis queue will be used, also install "yiisoft/yii2-redis"
  3. Update config file config/web.php as shown below. Check out the Module for more available options.

Enable module in configuration. Do it in both main and console configs, because some settings are used in migrations.

Copy migrations to your migrations folder and adjust dates in file and class names. Then apply migrations.

Define some queues as application components and optionally enable the module, see the next section.

$config = [
    // .........
    'aliases' => [
        '@nineinchnick/nfy' => '@vendor/nineinchnick/yii2-nfy',
    ],
    'modules' => [
        'nfy' => [
            'class' => 'nineinchnick\nfy\Module',
        ],
    ],
    'components' => [
        'dbmq' => [
            'class' => 'nineinchnick\nfy\components\DbQueue',
            'id' => 'queue',
            'label' => 'Notifications',
            'timeout' => 30,
        ],
        'sysvmq' => [
            'class' => 'nineinchnick\nfy\components\SysVQueue',
            'id' => 'a',
            'label' => 'IPC queue',
        ],
        'redismq' => [
            'class' => 'nineinchnick\nfy\components\RedisQueue',
            'id' => 'mq',
            'label' => 'Redis queue',
            'redis' => 'redis',
        ],
        // ..........
    ],
]

Then you can send and receive messages through this component:

// send one message 'test'
Yii::$app->dbmq->send('test');
// receive all available messages without using subscriptions and immediately delete them from the queue
$messages = $queue->receive();

Or you could subscribe some users to it:

Yii::$app->queue->subscribe(Yii:$app->user->getId());
// send one message 'test'
Yii::$app->queue->send('test');
// receive all available messages for current user and immediately delete them from the queue
$messages = $queue->receive(Yii:$app->user->getId());
// if there are any other users subscribed, they will receive the message independently

Module parameters

By specifying the users model class name in the userClass property proper table name and primary key column name will be used in migrations.

Display notifications

Put anywhere in your layout or views or controller.

$this->widget('nfy.extensions.webNotifications.WebNotifications', array('url'=>$this->createUrl('/nfy/default/poll', array('id'=>'queueComponentId'))));

Receiving messages

By configuring the WebNotifications widget messages could be read by:

Changelog

0.95 - 2014-01-15

Initial release after porting from Yii 1.


All versions of yii2-nfy with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version *
yiisoft/yii2-bootstrap Version *
php Version >=5.4.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 nineinchnick/yii2-nfy contains the following files

Loading the files please wait ....