News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthew Weier O'Phinney's Blog:
Code Generation with ZendCodeGenerator
March 28, 2011 @ 10:40:29

Matthew Weier O'Phinney has put together a beginners guide to code generation with the help of the Zend_CodeGenerator component of the Zend Framework (v2):

Zend Framework has offerred a code generation component since version 1.8, when we started shipping Zend_Tool. Zend_CodeGenerator largely mimics PHP's ReflectionAPI, but does the opposite: it instead generates code. [...] ZendCodeGenerator in the ZF2 repository is largely ported from Zend Framework 1, but also includes some functionality surrounding namespace usage and imports.

He includes an overview of the different code generation classes available (like PhpBody, PhpFile, PhpProperty, etc) and a bit of code to show you how to create a skeleton class that includes namespace use, class definition and the addition of a "get" method. He also offers some "tips" and "gotchas" to watch out for your first time around like the helpful automagic getter and setter handling.

0 comments voice your opinion now!
code generation zendframework codegenerator tutorial introduction


blog comments powered by Disqus

Similar Posts

Raphael Stolt's Blog: Teaching the Zend REST server to talk JSON

Danne Lundqvist: Using Xdebug in MAMP

ProDevTips.com: Extending PHP Doctrine Record - Check Box Groups

PHPInfo: Add Sting to PHP Apps with WASP Patterns

Hasin Hayder's Blog: RSA Encrypting and Decrypting data with Zend_Crypt_Rsa Library


Community Events











Don't see your event here?
Let us know!


opinion performance symfony2 component unittest podcast database hhvm application release hack facebook install security composer introduction language framework series package

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework