It’s Not A Framework
April 11, 2006 2 Comments
I almost forgot to mention, today I embarked on my pseudo-framework journey. I am not intending on making a MVC based framework. Philosophically, I think most of the ones are becoming bloated for the “Getting Real” sized applications for which they’re designed.
With leagues of PHP development under my belt, I’ve grown frustrated with the typical CRUD process that comes along with most web-applications. The solution? Going the extra mile for laziness.
Basic functions so far:
- The Database Object
- insert(string $table, arr $fields, arr $values)—pretty self explanatory. Obstacles here include fields that require single quotes in INSERT queries (dates, most text fields, enumerated & set fields).
- edit(string $table, arr $fields, arr $values)—same idea. Same obstacles.
- delete(string $table, string key_field, string key_value)—this one gets tricky. As a design decision, I have the option of finding out $table’s primary key from MySQL. Do I want to be restricted to single record deletion? Probably not.
- select_all(string $table, optional string $key_name, optional string $key_value)—will perform a SELECT * on $table, moving all results returned into a numered associative array, e.g., $userdata[$i][‘username’].
- connect and query (obvious)
- The Form Object
- show_edit(string $table, arr $fields, arr $values)
- show_insert(string $table, arr $fields)
- sanitize(string $string)—used in conjunction with the array_map function, this will just trim and strip potential harmful tags from input.
Where is all of this going? A happier, more efficient me.