|
|
Presentation of the core structure of the Plume Framework, with the different building blocks, like models, user management, permissions.
Presentation
The framework is mostly a MVC (Model View Controller) framework. It has been inspired after working with Django and being frustrated when creating extensions for Plume CMS.
The framework does not try to force you to develop in one way or another but provides you with a set of tools you can use mostly in an independent way. Of course they have been designed for you to develop faster if using them together.
Very basic usage
You can take benefit of the framework by simply including it at the start of your PHP script and possibly start it with a given configuration file.
// Use the framework
require 'Pluf.php';
// Start with a configuration file
Pluf::start('./conf/my-configuration.php');You do not need to do more than that. If you want to directly jump into the system without reading first the documentation, you can check the tutorial for a complete example of the creation of a todo manager.
Structure of the framework
The naming convention
If you look at the content of the Pluf folder, you will see all the classes available. The naming convention is the following:
A class named Pluf_HTTP_Response_Redirect_ will be implemented in the file Pluf/HTTP/Response/Redirect.php. By following carefully this convention, it is possible to automatically load the classes as needed. It means that you do not have to think about putting some require or include in your scripts, the loading is automatically performed for you.
Some of the important classes
Pluf
The core class. You need to include the Pluf.php file to enable the use of the Plume Framework (Pluf) in your application.
Pluf_Model
By extending the base Pluf_Model class, your object will have ready to use methods to save, update, delete and retrieve itself from the database and to get a list of those objects. This without the need to use any SQL. This is an active record ORM. See the detailed documention of the ORM.
Pluf_DB
A database abstraction layer. It is a very thin abstraction layer, for the moment only MySQL is supported but it is easy to implement your own layer. A Pluf_DB_Schema class is also available to automatically generate the tables required by a given Pluf_Model.
Pluf_HTTP_Request
A wrapper class around the traditional GET/POST/REQUEST/COOKIE variables. It provides also information about the currently logged user when the session middleware is loaded.
Pluf_HTTP_Response
The base class of a response to be sent to the browser. This is the object that is constructed in the views of your application. Different types of responses are available for you to handle common cases like a page not found or a redirection.
Pluf_Dispatcher
The dispatcher is a controller class. With a list of controls, the dispatcher will be able to find which object and method to call when a given action is requested in your application. The dispatcher can also load the Pluf_Middleware_* to pre/post process the request and response.
Pluf_Middleware_
The middleware are used in conjonction with the dispatcher to automatically modified a request or a response. The following middleware are available at the moment:
Pluf_Middleware_Session: This middleware, used together with the Pluf_User model and the login/logout views available in Pluf_Views, provides authentication to your application out of the box.
Pluf_Middleware_Tidy: This middleware is extremely usefull as if [Tidy|http://tidy.sourceforge.net] is installed on your system, you can validate dynamically all the pages produced by your application. The user sees nothing as the output of the pages is not modified but the log of the errors is automatically written in a temporary folder for later review.
Pluf_Mail
This class is a simple class you can use to easily send Mime encoded emails.
Pluf_SQL
The Pluf_SQL class provides easy methods to construct the WHERE clause of SQL requests in an SQL safe way by escaping all the possible bad characters and thus removing the possible SQL injection security issues.
Pluf_Template
The template class provides a simple yet powerfull template engine. The engine is fast as it is directly using the PHP tokenizer to parse the template and the template is then converted in pure PHP code that is evaluated by PHP. Template tags can easily be added by anybody having a little bit of PHP knowledge by extending the base Pluf_Template_Tag.
Pluf_Paginator
A simple class to provide a way to paginate through a list of objects extending the Pluf_Model and search through them.
Pluf_Form
All the form related classes. The form related classes allow to automatically generate the create/update form to handle the management of a Pluf_Model object.
Pluf_User, Pluf_Group, Pluf_Permission, Pluf_Session
These 4 classes are provided to easily manage users in groups with permissions associated to groups or directly to users. The Pluf_Session class is used to handle the website authentication.
Pluf_Crypt
A simple encryption class to easily encrypt/decrypt a string with a shared key. It is a very low tech encryption mechanism, not to be used for anything of big value.
Sign in to add a comment
