Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 651805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:12:09+00:00 2026-05-13T22:12:09+00:00

I have seen hooks in Kohana PHP framework, and they work as some sort

  • 0

I have seen hooks in Kohana PHP framework, and they work as some sort of a callback function triggered by a certain event (Kohana’s events that is, some sort of method overloading).

I have seen hooks in WordPress, and I don’t know what they are or how to use them (just saw them yesterday).

I’m looking for events in “non-frameworked” php, I cannot find ones.

Do hooks work only in an “event-based” environment? What are they anyway (in general, not just in PHP)? What are they good for if not in an “event-based” environment.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:12:09+00:00Added an answer on May 13, 2026 at 10:12 pm

    Hooks are, indeed, hooks into an event stack of sorts; a list of values some controller iterates over, and if you have anything registered to that event, the controller can run your custom code. But PHP itself doesn’t have anything (useful) like that, so you make it yourself or use the ones you find in your favorite application / system. It’s a fairly common way to create a plugin architecture, but can also be used for application control and other things. I’ve written earlier about my quest for a more universal event and operating set of stack events, including this post here on StackOverflow.

    As others have mentioned, PHP is stateless, so where I use them I use them as a simple execution list, and hook every part of my application into it. This way I’m very extensible, and have a basis for a plugin stack as well. (And I’ll release it one magical day when I’m bored or retired or just got too much time on my hands, etc.)

    You’ll find similar stacks and hooks in, for example, WordPress, so a plugin that deals with, say, CSS, will hook itself to the CSS_DEFINITION_EVENT (basically, that part of the WordPress application that writes CSS stuff into the HTML section). This stuff is everywhere. In PHP it only applies (well, mostly) to the limits of the request you get per PHP page (unless you’re doing PHP outside the webserver), but all major operating systems, applications, frameworks and systems have some form of event stack. PHP just doesn’t have one (seriously) built in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen this question and its answers and they clear up some of
I have seen some examples of wrapping text with PHP and GD to generate
Have seen some similar questions: What is the difference between a JavaBean and a
I have seen some people in SO commenting that Singleton Pattern is an anti-pattern.
By development of portlets, hooks etc. I have seen different approaches for logging in
I have seen a couple similar questions about this, however none of them work
Have seen some conversations revolving around this, but hoping for some current input as
I have seen Javascript code that claims to speed up function call overhead like:
I have some pretxncommit hooks in my local mercurial repository, those hooks are used
I have seen some post on this forum regarding Socket.IO and node.js. But still

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.