Download the PHP package alleyinteractive/wp-captain-hook without Composer

On this page you can find all versions of the php package alleyinteractive/wp-captain-hook. 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 wp-captain-hook

Captain Hook

Captain Hook is a library for WordPress developers to help them manipulate objects and methods hooked into actions and filters using otherwise-inaccessible object instances.

About

Oftentimes, a plugin will create an instance of an object in a function scope, or otherwise simply outside of the global scope, and then use that instance to hook methods into actions or filters. Here's an example:

If a developer wanted to unhook or otherwise alter the init method from the init action, they would need to have access to the $plugin instance. This is not possible from outside the scope of the anonymous function that created the instance.

Captain Hook provides a way for developers to access and manipulate these objects and methods, even when they are not accessible from the global scope. Features of this library include:

Installation

Install the latest version with:

Basic usage

Remove Action or Filter by Force

Reprioritize Actions and Filters

Retrieve an object instance

Here's a fictituous example using the above plugin code. That code uses dependency injection to pass a file-based logger to the Plugin_Main class. Say we want to log to Redis instead of a file, it looks like we should be able to replace the dependency using the set_logger() method -- however, we can't do that because we don't have access to the instance of Plugin_Main. Below, we leverage get_hooked_object to retrieve the plugin instance and then call the set_logger method on it to replace the file logger with a redis logger.

License

GPL-2.0-or-later

Maintainers

Alley Interactive


All versions of wp-captain-hook with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 alleyinteractive/wp-captain-hook contains the following files

Loading the files please wait ....