Download the PHP package pinkcrab/perique-plugin-lifecycle without Composer

On this page you can find all versions of the php package pinkcrab/perique-plugin-lifecycle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package perique-plugin-lifecycle

Perique - Plugin Life Cycle

A module for the PinkCrab Perique Framework which makes it easy to add subscribers which are triggered during various events within a plugins life cycle(Activation, Deactivation, Uninstall etc)

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require GitHub contributors GitHub issues

WordPress 5.9 Test Suite [PHP7.4-8.1] WordPress 6.0 Test Suite [PHP7.4-8.1] WordPress 6.1 Test Suite [PHP7.4-8.2] WordPress 6.2 Test Suite [PHP7.4-8.2]

codecov Scrutinizer Code Quality Maintainability

Requires
Perique Plugin Framework 2.0.*
Wordpress 5.9+ (tested from WP5.9 to WP6.2)
PHP 7.4+ (tested from PHP7.4 to PHP8.2)


Why?

Makes for a simple OOP approach to handling WordPress Plugin Life Cycle events such as Activation, Deactivation and Uninstallation.

Connects to an existing instance of the Perique Plugin Framework to make use of the DI container and other shared services. (Please note due to the way these hooks are fired, you may not have full access to your DI Custom Rules, please read below for more details.)


Setup

To install, you can use composer

Installing the Module

This must be bootstrapped with Perique to be used. This can easily be done on your main plugin file.

You can either pass the plugin_base_file as the path to the main plugin file, or if left empty will assume its the file used to create the app instance.

All events can be passed as there calss name, should be full namespace, or as a string of the class name.

Event Types

There are 3 events which you can write Listeners for. Each of these listeners will implement an interface which requires a single run() method.

Activation

All classes must implement the PinkCrab\Plugin_Lifecycle\State_Event\Activation interface.

This would then be run whenever the plugin is activated

Deactivation

All classes must implement the PinkCrab\Plugin_Lifecycle\State_Event\Deactivation interface.

These events will fail silently when called, so if you wish to catch and handle any errors/exceptions, this should be done within the events run method.

This would then be run whenever the plugin is deactivated

Uninstall

All classes must implement the PinkCrab\Plugin_Lifecycle\State_Event\Uninstall interface.

We automatically catch any exceptions and silently fail. If you wish to handle this differently, please catch them in your own code.

This would then be run whenever the plugin is uninstalled

Timings

The events are triggered before the init hook is called, so Perique is only partially booted when these are run. This means that you will have access to the DI_Container and App_Config but only custom rules that have been added directly, any rules added via 3rd parties using hooks, will not be available. Try to make events as simple as possible to avoid errors.

Extending

It is possible to create other modules which can be used to add additional events and trigger other actions both before and after the finalise() method is called. This is useful if you wish to add additional events, or trigger other actions.

Adding events

You can use the Plugin_Life_Cycle::STATE_EVENTS filter to add additional methods.

Const Plugin_Life_Cycle::STATE_EVENTS = 'PinkCrab\Plugin_Lifecycle\State_Events'

You can also use the Plugin_Life_Cycle::EVENT_LIST filter to add additional events, after they have been constructed with the DI container.

Const Plugin_Life_Cycle::EVENT_LIST = 'PinkCrab\Plugin_Lifecycle\Event_List'

Triggering actions before finalise

You can use the Plugin_Life_Cycle::PRE_FINALISE filter to trigger actions before the finalise() method is called.

Const Plugin_Life_Cycle::PRE_FINALISE = 'PinkCrab\Plugin_Lifecycle\Pre_Finalise'

Triggering actions after finalise

You can use the Plugin_Life_Cycle::POST_FINALISE filter to trigger actions after the finalise() method is called.

Const Plugin_Life_Cycle::POST_FINALISE = 'PinkCrab\Plugin_Lifecycle\Post_Finalise'

Change Log


All versions of perique-plugin-lifecycle with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
pinkcrab/perique-framework-core Version 2.0.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pinkcrab/perique-plugin-lifecycle contains the following files

Loading the files please wait ....