
What is vsPHP?
vsPHP is an extremely simple controller framework for PHP. It allows you to rapidly
develop your PHP/MySQL application. This framework is brand new and largely
undocumented at this point. The source code is downloadable and it should be
fairly easy to start developing with.
vsPHP is developed and maintained by Gabe Albert. vsPHP is licensed under GPL version 2.
Version History:
Feb. 22, 2007 - Initial release
How does vsPHP speed up my development?
When developing a new database-backed application, developers often spend hours
debugging queries and testing database connections. Using this framework, you will
create objects representing your database tables with a few lines of code. They
automatically "know" all of the basic CRUD (create/retrieve/update/delete) functions.
All you as a developer need to do is specify a table name, primary key, and the column names.
What are the limitations?
This framework does not understand foreign key relationships or perform joins. It is really very simple.
It is possible to work around this limitation by using your own data retrieval queries and populating
the corresponding objects. This will allow you to continue to use the persistence features.
Give me an example
This code was originally developed for a school project dealing with a car inventory
control system. In this system, vehicle inventory was stored in one table, "Vehicle".
<?php
|
Now, in order to display something from our Vehicle table, we can retrieve a record
based on the record's Stock_Number. First, we instantiate the Vehicle object. Next,
we call the populateByKey function, specifying the Stock_Number. This automatically
generates and executes all necessary SQL code to get the Vehicle row where
Stock_Number=100001. This information is populated into the field data of the
$vehicle instance.
<?php |
To output some data about the car, we simply use the built in getField method.
<?php |
That's it!