maslosoft/signals Wireless Cross-Component Communication

Maslosoft Signals

  1. Wireless cross-component communication
  2. Setup
  3. Usage

Wireless Cross-Component Communication

Latest Stable Version License Scrutinizer Code Quality Code Coverage Signals.svg?branch=master signals.svg?style=flat

Quick Install
composer require maslosoft/signals

Wireless cross-component communication

This component allows for interaction of application components, without prior or explicit assignment.


Use composer to install

composer require maslosoft/signals:"*"

Or by hard way, download somewhere in your project and ensure autoloading works for Maslosoft\Signals\* and you include dep too;

Setup signals. After calling init any further instance will be configured same as below $signal.

$signal = new Maslosoft\Signals\Signal();
$signal->runtimePath = RUNTIME_PATH;
$signal->paths = [

Generate signals definition, only once, hook it to your build script etc.

$signal = new Maslosoft\Signals\Signal();
(new Maslosoft\Signals\Utility($signal))->generate();


Emiting signal

Define signal:

namespace MyNamespace\Signals;

class AccountMenuItems extends AdminMenuItems
	public $item = [];

Define class with slot with @SlotFor annotation

namespace Maslosoft\Ilmatar\Modules;

class MyModule
	 * @SlotFor(MyNamespace\Signals\AccountMenuItems)
	public function reactOnAccountMenu(MyNamespace\Signals\AccountMenuItems $signal)
		$signal->item = [
			'url' => '/content/myBlog',
			'label' => 'My blog'

Emit signal and get results of this call:

$signal = new Maslosoft\Signals\Signal();
$result = $signal->emit(new AdminMenuItems());

echo $result[0]->item[0]['label']; // My blog
Gathering signals
0 0
1 follower
6 010 downloads
Yii Version: 1.1
License: AGPL-3.0-only
Category: Others
Developed by: pmaselkowski
Created on: Jul 22, 2018
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions