Categories
Uncategorized

Writing Pluggable PHP Code

I have been looking around at writing pluggable code. It intrigues me that you can write a system and then extend it for other users. Open Source software is all about the community contributing, and plugins are the latest way to let your community help build your system.

Here are the keys to writing plugins that I have found so far:

Identify all of your API requirements. What are the key points to your system. For wordpress, there are hundreds of such “hooks”.

You will most likely want two (2) hooks at every point that you want developers to change. Pre and Post.

Your code is very simple at this point.

<your code>
<Call Plugins for hook ABC>
ABC
<your code>

If you are going to print something to the screen, you can
<get info to be printed>
<Call plugins to modify info>
print info
<continue…>

I read Chris Corbyn’s “Writing a pluggable system in php” for more information.

Leave a Reply

Your email address will not be published. Required fields are marked *