I have been developing applications from a PHP framework and code generation system called QCodo recently. And more recently, its community-driven branch dubbed QCubed. The QCubed platform is beneficial to me mostly because it allows object-oriented PHP code to be generated from a MySQL database structure (as well as many others) . I use PHP/MySQL almost exclusively in projects here at Piranha Method, so this is a perfect tool for me.

There are a few parts to QCodo/QCubed that speed up my coding time. First, I mentioned code generation. This is the strongest feature and is what originally drew me to QCodo. If you provide QCubed with your database information, you can have it scan your DB and write pretty clean “drafts” of OOP PHP code based on relationships and foreign keys. It will also generate draft QForms that can be used to perform basic CRUD functionality with the objects it has generated from the database.

Which brings me to the next feature that QCubed offers: QForms and QControls. QForms are as the developer puts it “stateful, event-driven objects.” What this means is that each QForm is basically an HTML form that posts back to itself and remembers its state from the previous posting. No sessions or cookies are used.

QControls are essentially PHP objects that have defined getters/setters that can be overridden or added onto.  The QForm is responsible for rendering the QControl as HTML and handling any events that are applied to the QControl. QControls can be nested and expanded on to create really powerful web applications.

The last part of QCodo/QCubed are QQueries. This is a shortcut way to perform SQL Queries in an object-oriented manner. QQueries can take in conditions and clauses to provide custom loading of objects in your application. For instance take the following logic:

Select all Projects where: the Project ID <= 2 AND (the manager’s first name is alphabetically “greater than” the last name, or who’s name contains “Website”)

= Project::QueryArray(
QQ::GreaterThan(QQN::Project()->ManagerPerson->FirstName, QQN::Project()->ManagerPerson->LastName),
QQ::Like(QQN::Project()->Name, '%Website%')
QQ::LessOrEqual(QQN::Project()->Id, 2)

foreach ($objProjectArray as $objProject) {
_p(sprintf(‘%s (managed by %s %s)’, $objProject->Name, $objProject->ManagerPerson->FirstName, $objProject->ManagerPerson->LastName));
_p(‘<br/>’, false);

This is much easier to read and understand than the SQL command required to perform the same function. Also, if you change your database source you won’t have to rewrite code, as long as the relational structure stays the same.

I highly recommend you check out http://examples.qcodo.com and http://trac.qcu.be/projects/qcubed/wiki/Tutorials to get a sense of how powerful this framework truly is.

Be Sociable, Share!

7 Responses »

  1. I have to say, I just started working with QCubed and have found it to be a great tool for any PHP developer to use. When it comes to the frameworks generated code, it makes for a great start in building any PHP/MySQL driven application, you just got to remember that the framework builds drafts for you, and that you are meant to then take those and improve them, build upon them. As far as the development of the framework is going, its moving forward nicely, though I have to say… I feel their website doesn’t live up to a professional look, and the lack of an official logo is a bit of a problem, but these things CAN be improved, if they would just address them with serious thought. I for one have posted a concept logo for them, on their forums and hope that even if they don’t find it to be sufficient, that they look at this attempt and start actually addressing the issue. As for the website’s overall look/feel, I hope to contribute to that, and help them give off a bit more professional vibe.

  2. I have been trying to contribute to the QCubed community as much as possible, I just get swamped with clients’ requests. I have done some designs for them, but nothing complete. I will send you my files and maybe we can get the site design cleaned up a bit.

  3. I am really starting to like the collab system that you guys have been working on using the QCubed/QCodo framework. Hopefully we can additionally start integrating the QCubed/QCodo framework into the Concrete5 CMS (content management system), I don’t know if you guys have heard much about Concrete5 yet but I’ll post a blog entry on it shortly.

  4. As far as the collab system goes, Scott’s the man at the development side of it, I’m just working on the front end look and all. And as for this “Concrete5” I will take a look into it, I am familiar with a ton of cms’s, including joomla, wordpress, drupal, e107 and the list goes on, but never heard of Concrete5.

  5. Yeah, my QCubed CMS project was basically turning into Joomla. I have paused work on it for the moment, the collab system is my new project. I would really like to make a QCubed system similar to Concrete5 that will take advantage of the framework’s built-in AJAX capabilities.

  6. I just posted a little about Concrete5, I think it looks promising, especially if we could extend it with some more advanced data objects and form controls using QCubed or maybe even the Concrete5’s own framework (once I’ve had a chance to take a look at it).

  7. Pingback: PHP Framework Comparison | Web & Graphic Design Firm - Charlotte, Greenville, Charleston - The Piranha Method

Leave a Reply