PHPackages                             hongyukeji/plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hongyukeji/plugin

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hongyukeji/plugin
=================

A plugin system for PHP, with cascading events.

v1.5.1(6y ago)0119MITPHPPHP &gt;=5.4.0

Since Apr 29Pushed 6y agoCompare

[ Source](https://github.com/hongyukeji/plugin)[ Packagist](https://packagist.org/packages/hongyukeji/plugin)[ Docs](http://www.hongyuvip.com)[ RSS](/packages/hongyukeji-plugin/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (16)Used By (0)

Hongyukeji PHP Plugin system
============================

[](#hongyukeji-php-plugin-system)

A very complete plugin system to let you claim that your application supports plugins!

You will need PHP 5.4 for this to work.

[![Build Status](https://camo.githubusercontent.com/2a72bfacc185c27fe3673f3745d1032ac49a72d343d311b685df66f99ab5c4bd/68747470733a2f2f7472617669732d63692e6f72672f686f6e6779756b656a692f706c7567696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hongyukeji/plugin)[![Latest Stable Version](https://camo.githubusercontent.com/5d298da17a4228b4cc624f4a5d7ca4ce4f540bb8c09d8ee7929a8f03948e34be/68747470733a2f2f706f7365722e707567782e6f72672f686f6e6779756b656a692f706c7567696e2f762f737461626c65)](https://packagist.org/packages/hongyukeji/plugin)[![Total Downloads](https://camo.githubusercontent.com/f870af5f769b64778c19c78f90304222033ae28438339a3a3dccf444c814d247/68747470733a2f2f706f7365722e707567782e6f72672f686f6e6779756b656a692f706c7567696e2f646f776e6c6f616473)](https://packagist.org/packages/hongyukeji/plugin)[![License](https://camo.githubusercontent.com/a0d5349eafd2b60a1366b79b85bd946ab03bb066295a1baab7cf5e894eae43e9/68747470733a2f2f706f7365722e707567782e6f72672f686f6e6779756b656a692f706c7567696e2f6c6963656e7365)](https://packagist.org/packages/hongyukeji/plugin)[![composer.lock](https://camo.githubusercontent.com/9526c8107d6784ca19ffdd47f51fc2a4440c89dd6ce57d76f9ad9e0c0486e3a1/68747470733a2f2f706f7365722e707567782e6f72672f686f6e6779756b656a692f706c7567696e2f636f6d706f7365726c6f636b)](https://packagist.org/packages/hongyukeji/plugin)

Components
----------

[](#components)

```
php artisan vendor:publish --provider="Hongyukeji\Plugin\PluginServiceProvider"

```

Components
----------

[](#components-1)

- **Hooks**

    Place them in your code to execute events. Unlike several other packages, these Hooks allow interacting with the data and can hold the scope of the class.
- **Events**

    The events happen when a Hook with the same key is encountered. Events accept static methods and Closures, as well as a priority, because *you can stack them and have them passing variables to each other*.
- **Result**

    The object that Hooks and Events share, and return. They keep your code clean from mysterious function parameters and even more confusing return values.
- **Plugin**

    The internal package handler. *Plugins are actually Composer packages.* Use the bootstrap file to create new events and use the install/uninstall/upgrade hooks.
- **Loader**

    The packages utility. It looks into the folders you tell it to, finds plugins, loads them and give you the arrays.
- **PlugSuit** (trait)

    Add plugins automatically to your classes. It adds a before and after hook, and lets you override the parameters passed to the methods.

What will you have to do? You must use the Loader class to create your own administration panel and run the plugins you choose to run. Since it doesn't have any database bind (or any dependency at all), you must create an enabled/disabled system yourself.

Some examples follow.

You can go in-depth with these explanations with the following pages:

- [Hooks, Events and Results](hooks_events_results.md)
- [Plugin packages](plugin_packages.md)

Hooks and Events
----------------

[](#hooks-and-events)

The most basic part of the package. You can use Hook and Event anywhere in your code, not only in the plugins.

```
