Categories
zend framework 2

How to create your own controller plugin in ZF2?

Our step-by-step guide explains how you can create your own controller plugin in zf2.Fortunately creating controller plugin is very easy task. Create a directory called plugin in your module controller directory, then create a file for example ,Myfunctions.php. then place the blow code. Myfunction.php file is a php class that will extend the zf2’s AbstractPlugin, […]

Categories
zend framework 2

How to Send HTML Mail Using Zend Framework 2 (ZF2)

ZendMail provides generalized functionality to compose and send both text and MIME-compliant multipart email messages. Mail can be sent with ZendMail via the MailTransportSendmail, MailTransportSmtp or the MailTransportFile transport. Of course, you can also implement your own transport by implementing the MailTransportTransportInterface

Categories
zend framework 2

How to redirect to 404 page in zend Framework 2

The Zend framework automatically does this if the user selected route doesn’t exists. Although in some situations like getting data from database where the route is valid , but response is 404 (row not exits or may be row has been removed), in that case ,where may be we should have to show 404 page. […]

Categories
zend framework 2

How to Create,Get,Check Sessions in Zend Framework 2?

In GF2 in order to use Sessions we should use this use ZendSessionContainer; class. This class Container extends of ArrayObject and instantiates with ARRAY_AS_PROPS flag that means you can easily iterate through properties and read/write them. After Placing above line of code in place , you need to instantiate the ZendSessionContainer class and pass a […]

Categories
zend framework 2

How to compress html output in zend framework 2 ?

Today’s post is About HTML Output Compression, we can reduce 10-20% load on the server by compressing the HTML output(bandwidth save, faster page loading) we can easily compress the html Output in zend framework 2, with the help of zf2 events. On your main Modle.php create an event that will trigger on finish, module/application/modle.php