PHP Classes
elePHPant
Icontem

PHP Filters and Actions: Listen to events and execute registered actions

Recommend this page to a friend!
  Info   View files Example   View files View files (46)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-11-12 (8 months ago) RSS 2.0 feedNot enough user ratingsTotal: 101 All time: 8,969 This week: 530Up
Version License PHP version Categories
redbox-hooks 1.0MIT/X Consortium ...5PHP 5, Language
Description Author

This package can listen to events and execute registered actions.

It can register filter action handler functions that will be called before, during and after a given event is triggered.

It can also dispatch events and call all handler functions registered for the events when they are triggered.

  Performance   Level  
Name: Johnny Mast <contact>
Classes: 8 packages by
Country: The Netherlands The Netherlands
Age: 36
All time rank: 174251 in The Netherlands The Netherlands
Week rank: 52 Up2 in The Netherlands The Netherlands Up
Innovation award
Innovation award
Nominee: 3x

Details

redbox-hooks-logo-klein

Redbox-hooks

Build StatusScrutinizer Code Quality Twitter URL

Redbox-hooks allow you use Wordpress actions and filters in your own code. The syntax is easy to use as you expect it to be after seeing it in Wordpress it self.

If you want to look at some demo's in details then read the manual for:

Why was this package created?

This package was created because i am building a new modulair cms. I figured i could use a package like this and started building.

Fun fact

I a am not a TDD guy but 50% of this code was written with the TDD concept in mind. Actually i was pretty much surprised on how it worked out and the speed the development came in.

Requirements

The following versions of PHP are supported by this version.

  • PHP 5.6
  • PHP 7.0
  • PHP 7.1
  • HHVM

Known issues

If you come across a bug/issue you can always report them to the issue tracker. While developing this package this is something things i noticed. Those things are listed below.

Filter/Action function callback is not called

If you have functions inside a namespace. So should add the full namespace to the callback function like this example here.

namespace Sandbox\Demos;

use Sandbox\Filters;

function func_first($text = '')
{
    return '!!' . $text;
}
Filters::addFilter('prepend_at', 'Sandbox\Demos\func_first', 0);

Author

This package is created and maintained by Johnny Mast.

License

The MIT License (MIT)

Copyright (c) 2017 Johnny Mast

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

  Files folder image Files  
File Role Description
Files folder imagedemos (12 files)
Files folder imagesrc (3 files, 1 directory)
Files folder imagetests (1 file, 4 directories)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file ACTIONS.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file FILTERS.md Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  demos  
File Role Description
  Accessible without login Plain text file actions_chaining.php Example Auxiliary script
  Accessible without login Plain text file actions_classes.php Example Class source
  Accessible without login Plain text file actions_closures.php Example Auxiliary script
  Accessible without login Plain text file actions_functions.php Example Auxiliary script
  Accessible without login Plain text file actions_priority.php Example Auxiliary script
  Accessible without login Plain text file autoload.php Aux. Auxiliary script
  Accessible without login Plain text file filters_annotation.php Example Class source
  Accessible without login Plain text file filters_chaining.php Example Auxiliary script
  Accessible without login Plain text file filters_classes.php Example Class source
  Accessible without login Plain text file filters_closures.php Example Auxiliary script
  Accessible without login Plain text file filters_functions.php Example Auxiliary script
  Accessible without login Plain text file filters_priority.php Example Auxiliary script

  Files folder image Files  /  src  
File Role Description
Files folder imageAnnotations (2 files)
  Plain text file Actions.php Class Class source
  Plain text file Filters.php Class Class source
  Plain text file Hook.php Class Class source

  Files folder image Files  /  src  /  Annotations  
File Role Description
  Plain text file Filter.php Class Class source
  Plain text file FilterAnnotationHandler.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imageActions (5 files, 1 directory)
Files folder imageDemos (1 file)
Files folder imageFilters (6 files, 1 directory)
Files folder imageHook (1 file)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script

  Files folder image Files  /  tests  /  Actions  
File Role Description
Files folder imageAssets (3 files)
  Plain text file ActionsChainedTest.php Class Class source
  Plain text file ActionsClassesTest.php Class Class source
  Plain text file ActionsClosuresTest.php Class Class source
  Plain text file ActionsFunctionsTest.php Class Class source
  Plain text file ActionsStaticTest.php Class Class source

  Files folder image Files  /  tests  /  Actions  /  Assets  
File Role Description
  Accessible without login Plain text file CallbackFunctions.php Aux. Auxiliary script
  Plain text file MockClass1.php Class Class source
  Plain text file MockClass2.php Class Class source

  Files folder image Files  /  tests  /  Demos  
File Role Description
  Plain text file DemosTest.php Class Class source

  Files folder image Files  /  tests  /  Filters  
File Role Description
Files folder imageAssets (4 files)
  Plain text file FilterObjectTest.php Class Class source
  Plain text file FiltersChainedTest.php Class Class source
  Plain text file FiltersClassesTest.php Class Class source
  Plain text file FiltersClosuresTest.php Class Class source
  Plain text file FiltersFunctionsTest.php Class Class source
  Plain text file FiltersStaticTest.php Class Class source

  Files folder image Files  /  tests  /  Filters  /  Assets  
File Role Description
  Accessible without login Plain text file CallbackFunctions.php Aux. Auxiliary script
  Plain text file FilterObject.php Class Class source
  Plain text file MockClass1.php Class Class source
  Plain text file MockClass2.php Class Class source

  Files folder image Files  /  tests  /  Hook  
File Role Description
  Plain text file HookTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:101
This week:0
All time:8,969
This week:530Up