Table of Contents |
1. IntroductionThis document describes the Maintainable PHP Framework. It is a based around the Model-View-Controller pattern and is modeled after Ruby on Rails. It aims for compatibility with PHP version 5.1.4 and later. The Maintainable PHP Framework was originally built only for our own projects, then released to open source at the request of our customers. Like any framework, it's certainly not appropriate for every application. We designed it primarily for use with small- to mid- sized applications, and this is where it has been successful for us. Like anything in technology, you should evaluate it and your own needs carefully to see if it might be a good fit. This documentation is lacking in that we presently have no guide for setting up a new project, since internally we are accustomed to this process and it takes us little time. This may cause you some difficulty early on and is an area of the documentation that we may improve in the future. Maintainable Software is not able to provide free support beyond this documentation. We may be able to provide paid support, please contact us if you are interested. If you are developing a PHP project, particularly an open source one, please feel welcome and encouraged to incorporate this source code in whole or part to further your own effort. 1.1 License (BSD)
Copyright (c) 2006-2008, Maintainable Software, LLC. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.2 Subversion RepositoryThe Maintainable PHP Framework is available for anonymous checkout from this URL: http://framework.maintainable.com/svn/framework The Subversion repository is the only way to obtain this software. It is not available in other formats and this is unlikely to change in the near future. 1.3 Where is it?All applications built using the Maintainable framework share the exact same directory structure. This keeps projects consistent, allows team members to easily transition between projects, and allows for tooling that runs under the assumption of this structure. Most of the server-side application development will take place in the app/ and test/ directories. Client-side CSS, images, and JavaScript will be in the public/ directory. Vendor libraries such as the Maintainable framework itself and its dependencies reside in vendor/ to permit easy upgrading. 1.4 Application code The application code is split into three different layers. These layers are respectively split into the models/, views/, and controllers/ directories under /app, and we have conventions to determine how the files in here are named. We also have an additional helpers/ directory under here for view helper methods.
1.5 Web-accessible Images, CSS, and JavaScript are all stored in /public. 1.6 ConfigurationConfiguration is controlled by files in the config directory. The framework has the concept of runtime environments where a different configuration is loaded depending on the environment. Runtime environmentsThe three different runtime environments are:
Every request will include the common config/environment.php file and then its respective /config/environments/{environment}.php file. These files include constants and configuration used throughout the application. Normal MVC code that goes in app/ will never need require() statements as this is done automatically. Vendor (library) code in the vendor/ directory also does not need to be explicitly required because it will be autoloaded by the PEAR convention (which all vendor files must abide). URL RoutesRequest Routing is configured in /config/routes.php. This file defines what code gets run when a particular URL is requested. This is explained in more detail under Request Routing. 1.7 Vendor LibrariesAll vendor libraries, including the Maintainable framework itself, are located under vendor/. The framework does not invent its own plugin system or other exotic loading techniques. Libraries must simply reside in this directory and abide by the PEAR naming conventions. The Framework libraries are all under vendor/Mad/ and hence the classes are prefixed Mad_ by this convention.
The framework library consists of lightweight, object oriented classes that are loosely coupled but well integrated. They aim to make development clean, consistent, and agile. 1.8 Naming ConventionsThe framework has important naming conventions that are crucial to how the code integrates together. By sticking to these conventions, it makes code more consistent and less work gluing the pieces together.
|
||||||||||||||||||||||||||||