As far as I know, many PHP frameworks use syntactic sugar to provide illusion of real functions. Some provide scaffolding/skeleton generation, which is limited. Syntactic sugar is slow and IDE/editors do not provide intellisense for Syntactic sugar functions/methods and member data. I'm wondering if there any tool/framework to generate PHP code based on some popular frameworks and built around a relational schema? Thanks in advance.
-
To the dude who put vote down: Don't be so lame and cynical! Cite the rationales for your behavior! Others will benefit from my question.Viet– Viet2010-01-03 09:56:35 +00:00Commented Jan 3, 2010 at 9:56
-
Well, I didn't vote you down, but frankly, your question doesn't make much sense. What exactly are you looking to do?Michael Petrotta– Michael Petrotta2010-01-03 09:59:28 +00:00Commented Jan 3, 2010 at 9:59
-
I want a tool that generates PHP code based on SQL schema and avoid using syntactic sugar which has 2 drawbacks: Performance overhead and unrecognizable by PHP IDEs.Viet– Viet2010-01-03 10:03:27 +00:00Commented Jan 3, 2010 at 10:03
-
Built on a schema how? Can you give an example use case?Michael Petrotta– Michael Petrotta2010-01-03 10:07:28 +00:00Commented Jan 3, 2010 at 10:07
-
3So, you're looking for an ORM? Well, I'm not a PHP dev, so I could be wildly off here, but have you checked out Doctrine? doctrine-project.orgMichael Petrotta– Michael Petrotta2010-01-03 10:18:50 +00:00Commented Jan 3, 2010 at 10:18
6 Answers
Try Zend Framework.
Zend Framework (ZF) is an open source, object-oriented web application framework implemented in PHP 5 and licensed under the New BSD License.
Comments
I found QCodo http://www.qcodo.com/wiki/article/background/metaprogramming which satisfies requirements. Thank you very much for participating. You all earned my vote.
Comments
Zend_Framework has code generator called Zend_Tool, tough it's still unstable.
1 Comment
For posterity, I thought I would mention the rather impressive solution I just found to this problem.
Zend_CodeGenerator was added to Zend Framework as of, I believe, version 1.8, and I'm very impressed with it so far. Like most ZF components, it works just fine as a standalone tool; you needn't implement the rest of the framework in your project.
So far it seems easy to use and quite powerful.
Comments
Have a look at Cygnite Framework's Crud generator. It is very simple and easy to use. The New Cool Kid build on Symfony2 console component, I found interesting, made my job simple and fast.
Cygnite CLI generates controller, model, views, layout, form component, required field validation, pagination etc. with a simple command.
php cygnite generate:crud controller_name table_name database_name
You may alter the code based on your need.
Have a look, may help someone.