Extending a PHP class with plugins

October 31, 2010 by nuno costa 3 comments

It’s has been a while since I post anything useful or technical. My last posts all have ben sponsored by some one!

When I was writing the new version of phMagick I had a few requirements in mind

It should be:

  • Compatible with previous versions
  • Easy to incorporate patches and new features the community sends back
  • Small footprint (let the user choose what features he needs)

Having one big class would defeat the last 2 requirements, it would be too costly to manage contributions, and obviously there is no way to include just the features needed!

I tried some workarounds to php lack of multi inheritance support, but the code was just becoming to messy!

I come up with a solutions to “extend” a class by using a plugin system.

continue reading ยป

More from francodacosta.com

© francodacosta.com - All rights reserved