PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Basic Instructions for Creating Providers

As an example, if a developer wants to add the capability of showing the version of a datafile that his 3rd party component is working from, there is only one class the developer would need to implement. Assuming the component is called My_Component, he would create a class named My_Component_HelloProvider in a file named HelloProvider.php somewhere on the include_path. This class would implement Zend_Tool_Framework_Provider_Interface, and the body of this file would only have to look like the following:

<?php
class My_Component_HelloProvider
    
implements Zend_Tool_Framework_Provider_Interface
{
    public function 
say()
    {
        echo 
'Hello from my provider!';
    }
}

Given that code above, and assuming the developer wishes to access this functionality through the console client, the call would look like this:

% zf say hello
Hello from my provider!

Zend Framework