Do you know design patterns (a catalog of best practices)? There is a design pattern known as the "Observer pattern."
"The observer pattern is a useful solution for triggering events upon a specified occurence within your application.
For example you may have a beck end administration tool that allows authorized users to add articles to your Website. When an article is published. a number of things may need to happen in addition to storing the content in the database; for instance, you may need to refresh the site's cached HTML files, send an email to subscribers to inform them of the new content and perhaps
update a static XML document that contain your site's RSS feed, which others use to stay up-to-date about the content you publish. The observer pattern makes triggering these additional features easy and modular."
Source:
The PHP Anthology: Object Oriented PHP Solutions Volumn II page 347. The code comes with the book.
A pattern is nothing more than one or more classes. Look for PHP extensions, (Standard PHP Library) to PHP 5.0.
KW's: Standard PHP Library
Relevant article.
Introducing PHP 5's Standard Library