PHPackages                             bethropolis/plugin-system - 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. bethropolis/plugin-system

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

bethropolis/plugin-system
=========================

A lightweight plugin system &amp; manager for your PHP project

1.0.9(1mo ago)6261[3 PRs](https://github.com/bethropolis/plugin-system/pulls)MITPHPPHP ^8.0CI passing

Since Jul 12Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/bethropolis/plugin-system)[ Packagist](https://packagist.org/packages/bethropolis/plugin-system)[ Docs](https://bethropolis.github.io/plugin-system/)[ RSS](/packages/bethropolis-plugin-system/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (1)Versions (23)Used By (0)

A PHP Plugin System
===================

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

[![PHP test](https://github.com/bethropolis/plugin-system/actions/workflows/main.yml/badge.svg?event=push)](https://github.com/bethropolis/plugin-system/actions/workflows/main.yml) [![CodeFactor](https://camo.githubusercontent.com/d4a91d71038cbcb9fad6b6c3963dedc5fc4ac4acf487f43774be725861b09111/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f62657468726f706f6c69732f706c7567696e2d73797374656d2f6261646765)](https://www.codefactor.io/repository/github/bethropolis/plugin-system) [![Contributions](https://camo.githubusercontent.com/9e93e892d0685e1bf7a1d0bd7c8410d6ecf2086a0a7b48dd58a6b96fa556ea2a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6e747269627574696f6e732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/dopecodez/Wikipedia/issues) [![GitHub version](https://camo.githubusercontent.com/ea5cb919136b605705fbd4bd189f5d64dba31a4811cbd6bf9919731324905817/68747470733a2f2f62616467652e667572792e696f2f67682f62657468726f706f6c6973253246706c7567696e2d73797374656d2e737667)](https://badge.fury.io/gh/bethropolis%2Fplugin-system)

This is a lightweight, flexible, hook and event based plugin manager and system.

It allows you to easily integrate plugins feature into your PHP applications, providing a modular and extensible architecture.

Features
--------

[](#features)

- Easy integration
- Dynamic loading
- Hook-based architecture
- Event-driven programming
- Flexible and extensible
- plugin manager included
- plugin life cycle

Installation
------------

[](#installation)

you will require composer to install. Run the following command in your project directory:

```
composer require bethropolis/plugin-system
```

you can also download the latest release and add it to your project directory.

> note that if you do this you will have to require the autoloader file into your project scripts. example

```
require "plugin-system/src/autoload.php";
```

Usage
-----

[](#usage)

### Loading Plugins

[](#loading-plugins)

To load plugins from a specific directory, use the `loadPlugins` method:

```
require "vendor/autoload.php"; // for download installed method just replace this line with the autoloader.

use Bethropolis\PluginSystem\System;

$dir = __DIR__ . "/examples/"; # directory to load plugins from
System::loadPlugins($dir);
```

Linking Plugins to Hooks
------------------------

[](#linking-plugins-to-hooks)

Plugins functions can be linked to hooks using the `linkPluginToHook` method. This allows you to define actions that will be executed when a particular hook is triggered:

```
use Bethropolis\PluginSystem\System;

// Link a plugin function to a hook
System::linkPluginToHook('my_hook', $callback);
```

### Triggering Hooks and Events

[](#triggering-hooks-and-events)

Hooks can be triggered using the `executeHook()` method, and events can be triggered using the `triggerEvent()` method. Here's an example:

```
use Bethropolis\PluginSystem\System;

// Trigger a hook
System::executeHook('my_hook', $pluginName, ...$args);

// trigger multiple hooks
System::executeHooks(['my_hook1', 'my_hook2'], $pluginName, ...$args);

# Events
// Register an event
System::registerEvent('my_event');

// Add an action to the event
System::addAction('my_event', function ($arg) {
    // Action code here
});

// Trigger the event
System::triggerEvent('my_event', ...$args);
```

plugin
------

[](#plugin)

here is an example of a plugin:

```
// eg. FILE: /plugins-folder/examplepugin.php

class ExamplePlugin extends \Bethropolis\PluginSystem\Plugin
{

    public function initialize()
    {
        $this->linkHook('my_hook', array($this, 'myCallback'));
    }

    public function myCallback($name = [])
    {
        $name = array_shift($name);
        return "hello {$name}";
    }
}
```

more Examples
-------------

[](#more-examples)

The [examples](examples/) directory contains sample plugins that demonstrate the usage of the Plugin System.

Contributing
------------

[](#contributing)

Contributions to the project are welcome! If you encounter any issues, have suggestions for improvements, or would like to add new features, please feel free to open an issue or submit a pull request.

About
-----

[](#about)

this project was made to be a plugin management system for another one of my [project](https://github.com/bethropolis/suplike-social-website) but I hope it can help someone else out there.

License
-------

[](#license)

this project is released under the [MIT License](https://opensource.org/licenses/MIT). You can find more details in the [LICENSE](LICENSE) file.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance89

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~123 days

Recently: every ~244 days

Total

9

Last Release

55d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fa04144f8035aa631d9f221a8dc977e9f1b57a6d26ce26a38539a2826700c081?d=identicon)[bethropolis](/maintainers/bethropolis)

---

Top Contributors

[![bethropolis](https://avatars.githubusercontent.com/u/66518866?v=4)](https://github.com/bethropolis "bethropolis (82 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![totoprayogo1916](https://avatars.githubusercontent.com/u/2387514?v=4)](https://github.com/totoprayogo1916 "totoprayogo1916 (1 commits)")

---

Tags

extensionextension-systemphpphp-plugin-systemplugin-managerplugin-systempluginspluginplugin-systemplugin-manager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bethropolis-plugin-system/health.svg)

```
[![Health](https://phpackages.com/badges/bethropolis-plugin-system/health.svg)](https://phpackages.com/packages/bethropolis-plugin-system)
```

###  Alternatives

[ergebnis/composer-normalize

Provides a composer plugin for normalizing composer.json.

1.1k37.3M2.1k](/packages/ergebnis-composer-normalize)[daixianceng/yii2-smser

Yii2 SMS extension

862.9k1](/packages/daixianceng-yii2-smser)[coldtrick/profile_manager

Improved management of user and group profile fields

293.7k1](/packages/coldtrick-profile-manager)[coldtrick/widget_manager

Manage your widgets

214.3k](/packages/coldtrick-widget-manager)[coldtrick/thewire_tools

Extend the functionality of The Wire

133.2k](/packages/coldtrick-thewire-tools)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
