Reputation: 4898
I working on old PHP app that is written in vanilla PHP. There is no any kind of MVC, but the good thing is that I can use composer.
I want to use ZF2 FlashMessenger. As I know FlashMessenger is only helper, part of zend-mvc and zend-view. But the question is can I use it withouth ZF2 MVC as a standalone component and how?
For eg. there is such a thing in Symfony FW - The HttpFoundation Component. Where you can have flash messanger in several lines of code
use Symfony\Component\HttpFoundation\Session\Session;
$session = new Session();
$session->start();
// set flash messages
$session->getFlashBag()->add('notice', 'Profile updated');
// retrieve messages - later in layout
foreach ($session->getFlashBag()->get('notice', array()) as $message) {
echo '<div class="flash-notice">'.$message.'</div>';
}
Upvotes: 0
Views: 86
Reputation: 937
I think there's no way wihout using at least ZendFrameworkSkeleton, since any other Single-Application (e.g. ZF-Tool) is based on it. You can setup a Messenger-Apllication with that in a seperate directory and call it by url where you need it.
Upvotes: 0