View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}


[aissam AT yahoo|]

0.1 - 8 June 2006: First Version

Zend_Service_Google will offers a simple and standard interface for dealing with Google's Service


* [Google's API|]

* PHP 5.1.4 (with SOAP enabled)

* Zend_Service_Exception
* Zend_HttpClient
* Zend_Feed


Zend_Service_Google will offer two simple methods (getService and callService).
It's organised by plugins-like system, so any additional service could be easily
added. Each plugin will be responsable for one specific Google API,
and will take care for dealing with a the google service :
connect, send query, get/parse result, and return it in an easy to use format
(object, array, string or XML)


For advanced users:

* Zend_Service_Google
* Zend_Service_Google_AGMailAtom
* Zend_Service_Google_ASearch
* Zend_Service_Google_AAnotherService
(one classe for each API: format Zend_Service_Google_A<nameOfApi>)

For "no time to RTFM" users ;)

* Zend_Service_Google_Mail
* Zend_Service_Google_Search
* Zend_Service_Google_Spelling
* Zend_Service_Google_Cache


Simplest Way
$gMail=new Zend_Service_Google_Mail($login,$password);

$gSearch=new Zend_Service_Google_Search($lincenceKey);

$gSpell=new Zend_Service_Google_Spelling($lincenceKey);

$gCache=new Zend_Service_Google_Cache($lincenceKey);

Unified Way
$g=new Zend_Service_Google($lincenceKey);
$result=$g->callService('nameOfService', $data1,$data2...);

Advanced Way (need little knownledge for Google's API or Zend_Service_Google's API)

$g=new Zend_Service_Google();

$searchResult= $searchObj->doGoogleSearch($keyword);
$spellResult = $searchObj->doSpellingSuggestion($keyword);
$cachResult = $searchObj->doGetCachedPage($url);



Class Zend_Service_Google {

/* Services provide a list indexed by aliases */
private $services=array(
'search' =>array('class'=>'Search', 'method'=>'doGoogleSearch'),
'spellCheck' =>array('class'=>'Search', 'method'=>'doSpellingSuggestion'),
'serviceName' =>array('class'=>'AnotherGoogleAPIClass','method'='method')

* Construct a Google main service
* @param string (optional) licence Key
* @param string (optional) specific google service's options
public function __construct($licenceKey = null,$otherServicesOptions=null) {

* Get a Specific Service Object
* @param string ServiceName
* @param string (optional) Service init Arguments
* @return object Specific Service's Object
public function getService($serviceName,$args=null) {
// return object of a specific service (if it's already loaded)
// or create a new one (using $services)

* Call a Service using it's name
* @param string ServiceName
* @param array Arguments usually input data requested by service
* @return mixed Service Call Result (search result, spellcheck, cached page content, ...)
public function callService($serviceName) {
// getService(name) and call the corresponding method described in $services