MVC revisted
| From: | Tony Bibbs | Date: | Tue, 11 May 2004 14:55:28 +0000 |
| Subject: | MVC revisted | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-29082@lists.php.net to get a copy of this message | ||
Some time ago I posted about the possiblities of including an MVC framework into PEAR. At the time it was met with mixed emotions as some people had a hard time conceptualizing why having a framework in PEAR would be beneficial. I am hoping that by giving this topic a little rest that others have had time to become with the MVC design pattern and see how the benefits of such a package could benefit PHP projects. So, again a brief overview of the MVCnPHP package I have built:
1) Supports any templating system. There are some abstract classes representing views that make wiring up any template engine possible.
2) Supports any data access scheme. Want to use raw mysql calls? Want to use PEAR::DB? It's up to the developer, MVC simply provides the framework to make the data access layer consistent throughout an application.
3) A lightweight controller that simply loads the MVC configuration and serves as a proxy to the MVC objects
4) No desire to be like Struts. That's right, I have used Struts and frankly find it is overkill, hard to learn and difficult to debug with. This MVC implementation it meant to be lightweight and simple yet provide a powerful means for seperating the UI, businesss logic and data access.
5) Includes a basic persistence manager. The use of the Persistence Manager is optional but, when used provides a seamless way to save data in your models to the database. In otherwords, the Persistence Manager removes any need for using SQL yet can be overridden when required. The Persistence Manager does, however, require the use of PEAR::DB.
6) MVCnPHP handle code efficiently. Only the code needed to process the current request is ever loaded into memory and it is only loaded as needed. 7) With the exception of the controller, you can put all MVC objects, including the MVC configuration outside of the webtree for tightened security.
8) MVCnPHP can be configured using a PHP array or by editing a straightforward XML file
9) More atomic code. Commands in the MVC framework only do one task, this makes reuse easier and eases the burden of maintainability.
The readme for this package is a good place to start learning about the package:
http://cvs.geeklog.net/co.php/MVCnPHP/README.txt
The code can be viewed online:
http://cvs.geeklog.net/cvs.php/MVCnPHP
I'd really like to see this added to PEAR as I think the benefits to large PHP applications is tremendous. Questions, concerns?
--Tony