LemonInflux Posted May 9, 2008 Share Posted May 9, 2008 Hello, I'm just wondering how to make an efficient plug-in system. So far, I've thought of including the class, and putting all the plug-in functions into the constructors and destructors, however I was wondering if there is a better way of doing it. Has anyone got any experience in creating plug-ins? Thanks in advance, Tom. Link to comment https://forums.phpfreaks.com/topic/104878-plug-in-systems/ Share on other sites More sharing options...
trq Posted May 10, 2008 Share Posted May 10, 2008 You might want to take a look at the filter chain pattern. Can be usefull in this type of situation depending on how your application is designed. Link to comment https://forums.phpfreaks.com/topic/104878-plug-in-systems/#findComment-537332 Share on other sites More sharing options...
448191 Posted May 10, 2008 Share Posted May 10, 2008 AFAIK there is no 'official' pattern called 'Filter Chain'. There's Java's Filter.Chain, but that's an implementation of Intercepting Filter. There's Chain of Responsibilty, which can be used for chaining filters. The Composite pattern can be used to assemble highly specialized filters. Decorator can be used to create filter chains as well. Last, but not least, the Plugin pattern could be used for this purpose. The latter probably being what the TS is after: linking (any purpose) classes during configuration time, rather than compilation time. Check out this thread for an example of Plugin: http://www.phpfreaks.com/forums/index.php/topic,189363.msg851770.html#msg851770 Link to comment https://forums.phpfreaks.com/topic/104878-plug-in-systems/#findComment-537391 Share on other sites More sharing options...
trq Posted May 11, 2008 Share Posted May 11, 2008 Its the intercepting filter pattern I was likely talking about, I'm really not up on the names of patterns much, Ive always refered to it as a filter chain, not sure where that might have come from. Link to comment https://forums.phpfreaks.com/topic/104878-plug-in-systems/#findComment-537969 Share on other sites More sharing options...
448191 Posted May 11, 2008 Share Posted May 11, 2008 Intercepting Filter is mostly useful for manipulating your request and response objects. For example, you might have a filter which checks some ACL rules and changes the dispatch target to an 'unauthorized' page when appropriate. Combinations with the Plugin pattern are common, if not implied by definition. Link to comment https://forums.phpfreaks.com/topic/104878-plug-in-systems/#findComment-538160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.