PHP Scaffold Class 16
I’ve done web development for quite some time now and I hate writing CRUD as much as the next guy. As a developer your goal should be to not ever write the same code twice. But when creating CRUD systems for different projects this is impossible. You always find yourself doing the same thing, over and over again. Most coders have been enticed by Ruby on Rails’s “weblog in 15 minutes” screencast. There are also PHP frameworks that boast the same functionality. I’ve never had the desire to learn any of these systems and, honestly, EzSQL teamed with Smarty gets the job done quite nicely.
A few years ago I ran across this article and ever since I have been building on the ideas presented to create an extremely powerful PHP Scaffold Class that I have used in numerous production sites. In it’s simplest implementation, all you do is pass the table name to the class and the scaffolding is created based on the table’s structure. Over time I’ve added functionality for table relationships, image uploading and resizing, and more.
I imagine this class could be very useful to the PHP community. I plan on refining it further and eventually making it available to the public. My purpose in writing this post is to find out if there’s any interest in this sort of thing and to see if, and how much, people would be willing to pay for a license to use it. Your feedback is welcome in the comments below.
Features
- Parent/Child relationships
- Image uploading and resizing
- Thumbnail generation
- WYSIWYG text fields
- Disable certain actions (show, add, edit, or delete)
- Handles SET or ENUM fields as select boxes
- Sort by any of the columns
- Pagination
- Hide different columns from the listing table or from all views
- Automatic recognition and handling of created and modified date fields
- Extremely flexible
Demo
I’ve setup an example of a simple store backend to show its functionality. You can view the code and database structure by clicking the links at the top. Here is an example of a frontend that has been built on top of a backend powered by this class.