Sunday 27 November 2005 11:03:00 pm
This article provides a glimpse into the usage of the eZ Components for PHP 5. They are object oriented and reusable building blocks which will speed up development and deployment of enterprise applications based on PHP 5.
eZ Components is an enterprise ready general purpose PHP components library. As a collection of high quality independent building blocks for PHP application development eZ Components will both speed up development and reduce risks. An application can use one or more components effortlessly as they all adhere to the same naming conventions and follow the same structure. All components are based on PHP 5.1, except for the ones that require the new Unicode support in PHP 6.
The eZ Components in a nutshell:
More general information about the eZ Components is available at the product page. Furthermore, there is a list of available components. Technical aspects of how the library is built-up are explained at the technical details page.
The future of the eZ Components are listed on a separate page .
The purpose of the eZ Components is to hide complexity of routines behind an object oriented API. Regular tasks of programming become much easier, and due to the fact that complexity is being reduced, the risk of application development is minimized. In general, your development process will become more efficient.
For example, sending an email with the help of the eZ Mail component, looks like this:
<?php< try { $transport = new ezcMailTransportSmtp( "smtp.example.com" ); $mail = new ezcMail(); $mail->from = new ezcMailAddress( "null@example.com", "Test" ); $mail->addTo( new ezcMailAddress( "derick@tequila" ) ); $mail->subject = "[Components test] SMTP test"; $mail->body = new ezcMailText( "Content" ); $transport->send( $mail ); >} catch ( Exception $e ) { echo "Failed: ", $e->getMessage(), " "; } ?>
Of course you need to change the SMTP server's IP ( smtp.example.com) and definitely the email adresses in the sample code to fit your needs. For more examples of each of the eZ Components, take a look at the doc/ directory of each component where some sample code is provided.
Please notice that the eZ Components will only work on PHP 5.1.1 or higher. They can be used side-by-side with PEAR packages that as well run on PHP >= 5.1.1.