HostingPackagesEvent events
3 FeatherPanel plugin events on HostingPackagesEvent (3 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.
Last synced from FeatherPanel 15b94e9 on .
On this page
Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions.
Setup
Import HostingPackagesEvent in your entry class and register listeners in processEvents():
<?php
namespace App\Addons\myplugin;
use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\HostingPackagesEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(HostingPackagesEvent::onHostingPackageDeleted(), function ($packageId, $package): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:hosting_packages:package:deleted ' . json_encode(['package_id' => $packageId, 'package' => $package]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}HostingPackagesEvent::onHostingPackageCreated()
Docblock: array package data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | package | $package | arrayfrom docblock |
When it fires (1 site)
HostingPackagesController::createviaemitPluginEvent()PUT /api/admin/hosting-packages
$event->on(HostingPackagesEvent::onHostingPackageCreated(), function ($package): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:hosting_packages:package:created ' . json_encode(['package' => $package]));
});HostingPackagesEvent::onHostingPackageDeleted()
Docblock: int package id, array package data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | package_id | $packageId | int |
| 2 | package | $package | arrayfrom docblock |
When it fires (1 site)
HostingPackagesController::deleteviaemitPluginEvent()DELETE /api/admin/hosting-packages/{id}
$event->on(HostingPackagesEvent::onHostingPackageDeleted(), function ($packageId, $package): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:hosting_packages:package:deleted ' . json_encode(['package_id' => $packageId, 'package' => $package]));
});HostingPackagesEvent::onHostingPackageUpdated()
Docblock: int package id, array package data.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | package_id | $packageId | int |
| 2 | package | $package | arrayfrom docblock |
When it fires (1 site)
HostingPackagesController::updateviaemitPluginEvent()PATCH /api/admin/hosting-packages/{id}
$event->on(HostingPackagesEvent::onHostingPackageUpdated(), function ($packageId, $package): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:hosting_packages:package:updated ' . json_encode(['package_id' => $packageId, 'package' => $package]));
});