Download the PHP package flexpress/component-hooks without Composer

On this page you can find all versions of the php package flexpress/component-hooks. 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 component-hooks

FlexPress theme component

Install via pimple

Before we done anything else we need to setup the configs in pimple

What we have done here is created two configs, one for the hooker and one for a hookable class, we have then passed in the configHookable to the hooker so it can hook all its hooks up.

Note that that $c['objectStorage'] is the SPLObjectStorage class.

Setting up hooks

To add hook we must first create a class that uses the HookableTrait, lets make a very basic class that does this:

Simples, all done but we should probably add a hook method, so lets do that now:

This example adds a hook for the config class and the adminInit function for the action admin_init, not that the method is in camelcase.

As well as setting up actions you can add filters like this:

In this example we have added a filter that strips the tags from the title by hooking into the the_title filter.

So for filters you simply add this to the docblock above the method:

and for filters you do the same but change the type to filter:

Advanced usage

As well as specifying the type of hook you can also specify the priority like this:

And finally you can also specify the number of paramters you expect like this:

Which allows you to add both action and filter hooks, speficy the priority as well as the number of params you expect, so nothing is taken away from the add_action and add_filter functions.

Public methods - Hooker

Public methods - HookableTrait

Protected methods - HookableTrait


All versions of component-hooks with dependencies

PHP Build Version
Package Version
No informations.
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 flexpress/component-hooks contains the following files

Loading the files please wait ....