定制 selvinortiz/gossip 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

selvinortiz/gossip

Composer 安装命令:

composer require selvinortiz/gossip

包简介

Lightweight event broadcasting library for PHP 5.4+

README 文档

README

Gossip

Build Status Total Downloads Latest Stable Version

Description

Gossip is a tiny event broadcasting library written by Selvin Ortiz

Requirements

Install

composer require selvinortiz/gossip

Test

sh spec.sh

Usage

Event broadcasting is a fancy way of saying that Gossip allows you to register your responders to listen for a specific event and when that event is whispered, it can respond.

use SelvinOrtiz\Gossip\Gossip;

class App
{
	public function init()
	{
		Gossip::instance()->whisper(new Event('app.init'));
	}

	public function end()
	{
		Gossip::instance()->whisper(new Event('app.end', [$this]));
	}

	public function log($message)
	{
		// Log a $message to db or file system
	}
}

// Called when app.init is whisper()ed
Gossip::instance()->listen('app.init', function (Event &$event) {
	// Bootstrap third party code, initialize services, etc.
});

// Called only the first time app.end is whisper()ed
Gossip::instance()->listenOnce('app.end', function (Event &$event, $app) {
	// Close db connections, destroy sessions, etc.
	$app->log('Application is ending...');
});

API

API reference is coming soon...

Contribute

Gossip wants to be friendly to first time contributors. Just follow the steps below and if you have questions along the way, please reach out.

  1. Fork it!
  2. Create your bugfix or feature branch
  3. Commit and push your changes
  4. Submit a pull request

License

Gossip is open source software licensed under the MIT License

统计信息

  • 总下载量: 178
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-09-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固