Клас Yaf_Plugin_Abstract
(Yaf >=1.0.0)
Вступ
Плагіни дозволяють легко розширювати та налаштовувати фреймворк.
Плагіни є класами. Визначення класу змінюватиметься залежно від компонента - вам може знадобитися реалізувати цей інтерфейс, але факт залишається фактом, плагін сам є класом.
Плагін повинен бути завантажений у Yaf з використанням Yaf_Dispatcher::registerPlugin(). Після реєстрації всі методи, реалізовані плагіном відповідно до цього інтерфейсу, будуть викликатися вчасно.
Приклади
Приклад #1 Приклад плагіна
Loading...
Висновок наведеного прикладу буде схожим на:
string(13) "routerStartup"
string(14) "routerShutdown"
string(19) "dispatchLoopStartup"
string(11) "preDispatch"
string(12) "postDispatch"
string(20) "dispatchLoopShutdown"
Огляд класів
class Yaf_Plugin_Abstract
{
/* Методы */
public dispatchLoopShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void
public dispatchLoopStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void
public postDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void
public preDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void
public preResponse(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void
public routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void
public routerStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void
}
Зміст
- Yaf_Plugin_Abstract::dispatchLoopShutdown— Призначення dispatchLoopShutdown
- Yaf_Plugin_Abstract::dispatchLoopStartup - Хук перед відправкою циклу
- Yaf_Plugin_Abstract::postDispatch - Призначення postDispatch
- Yaf_Plugin_Abstract::preDispatch - Призначення preDispatch
- Yaf_Plugin_Abstract::preResponse - Призначення preResponse
- Yaf_Plugin_Abstract::routerShutdown - Призначення routerShutdown
- Yaf_Plugin_Abstract::routerStartup - Перехоплювач RouterStartup