Skip to content

Category: php

Zend Framework : Sending emails using Zend_Mail and Google Smtp

Sending emails using Zend_Mail component from Zend Framework is an easy as it can get task. On a recent project, i needed to configure Zend_Mail to work with Google Smtp server. Here is a quick how to: $settings = array(’ssl’=>’ssl’, ‘port’=>465, ‘auth’ => ‘login’, ‘username’ => ‘[email protected]’, ‘password’ => ‘YOUR_PASSWORD’);…

Revisiting PHP 5.3 __invoke magic method

PHP version 5.3 introduced a new magic method designed __invoke, this method is called when a script tries to call an object as a function.

The __invoke magic method

< ?php
 
class Car {
 
	public function __invoke($v) 
	{
		echo "Just called object as function with parameter '".$v."'\n";
	}
 
}
 
$c	=	new Car;
 
// Just to make sure we have an object
echo "I am an object of type: ".get_class($c)."\n";
 
// Now let's use it as a function
$c('ford');

Speeding up your application with Cache_Lite

Cache_Lite is one of the fast, light and reliable cache system for PHP. It’s an extremely easy and small learning curve system to work with. This post will try to make you a light introduction to PHP Cache_Lite.

Installing PEAR Cache_Lite

In order to work with Cache_Lite you need to install the PEAR package.

pear install Cache_Lite-1.7.8

Starting with Cache_Lite

Is easy as instantiating the object to start using Cache_Lite.