What is PRADO?
The PRADO framework is an open source programming framework for creating professional web applications. PRADO means PHP Rapid Application Development Object-oriented. It is component-based and allows event-driven programming. PRADO, which has a configurable and pluggable modular architecture, supports Ajax components and offers customizable and localizable error handling, generic caching modules and selective output caching.
This free PHP framework only requires a web server with PHP 5.1.0 or later. Granted with a revised BSD License, PRADO is suitable for developing both open source and commercial applications.
|PHP5||PHP v.5.1.0 or later|
PRADO framework - overview and examples
The PRADO framework's main goal is to ensure reusability in web programming, which involves not only reusing one's own code, but also others’, and which may considerably decrease the development time. The introduction of the notion of the component is for this purpose.
Being a component-based framework, PRADO offers a protocol for writing components to build web applications. A component is a self-contained software unit that can be reused after a small customization. New components can be created by combining existing ones.
So as to facilitate the interaction with the components, PRADO executes an event-driven programming method that allows delegation of extensible behavior to the components. End-user activities, among them clicking on a submit button, are captured as server events. Methods or functions may be attached to these events so that when the latter happen, they are invoked automatically to respond to them. The event-driven programming model helps developers to better focus on the necessary logic and reduces the low-level repetitive coding as compared to the traditional web programming where they have to deal with raw POST and GET variables.
In summary, the development of a PRADO web application basically involves instantiation of prebuilt component types and their composition into pages in the application. You have to set their properties to configure them, and write handler functions to respond to their events. PRADO, which is very easy to learn, resembles ASP.NET, unlike other PHP frameworks.
In PRADO, users can directly access only one script - namely the application's index.php entry script. This file is required by all PRADO applications and mainly consists of the following three lines.
Example of index.php in the PRADO framework<?php
// include the prado script
// create a PRADO application instance
// run the application
This index.php file, along with the whole directory/file structure of a PRADO application, can be quickly created using the integrated PRADO CLI:
How to create application's directory structured using PRADO CLIphp prado-cli.php -c app-directory
A PRADO component combines a specification file, an HTML template and a PHP class. The template file, for example 'Test.page', specifies the presentational layout of the components. In the example below you can see two components, TForm and TButton, which correspond to the <form> and <input> HTML tags, respectively.
Example of a basic PRADO template - Test.page<html>
<com:TButton Text="Click me" OnClick="buttonClicked" />
The page class for the Test page - test.php, mainly contains the method responding to the OnClick event of the button.
Example of an event class file in PRADO<?php
class Home extends TPage
public function buttonClicked($sender,$param)
// $sender refers to the button component
In order to establish a database connection one should create a TDbConnection instance and activate it. In case of a MySQL connection it would look like this:
Example of an establishing database connection in PRADO//$dsn should have format: mysql:host=myhost.com;dbname=mydbname
$conn = new TDbConnection($dsn,$username,$password);
//Use this to activate your connection
//Use this to deactivate it
//Prepare the TDbCommand command using the createCommand statement
$cmd = $conn->createCommand($sqlCommand);
//Execute non-query sql statement (INSERT,UPDATE,DELETE)
$affectedRows = $cmd->execute();
//Query database statement (SELECT)
$sqlData = $cmd->query();
// retrieving all rows at once in a single array
PRADO - features summary
PRADO can be used for creating user-interactive web applications, simple blogs and forums, complex content management systems and even complete e-commerce solutions.
PRADO offers an entire set of caching techniques which help accelerate PRADO-based web applications to meet the high traffic requirements. Its modular architecture enables developers to use different cache modules or to cache parts of a rendered web page.
The list below summarizes PRADO's main features:
- Reusability - Helps developers as they can reuse their previous work and easily integrate others'.
- Event-driven programming - End-user activities, such as mouse clicking or key pressing, are captured as server events.
- Web controls - Using PRADO, which offers a set of components for web user interfaces, you can create interactive web pages with a few lines of code. By using the datagrid component you can build a page in the form of a data table allowing paging, sorting, editing, and deleting of the rows.
- Database support - PRADO offers complete database support. Depending on the complexity of the business objects, you can pick the simple PDO-based data access, the popular active record, or the complete business object mapping scheme SqlMap.
- XHTML compliance - PRADO-generated web pages are XHTML-compliant.
- Accommodation of existing work - PRADO, which is a framework focused on the presentational layer, does not ban developers from using existing class libraries or toolkits. You can use ADOdb or Creole in your PRADO application, for example.
- Other features:
- customizable and localizable error/exception handling and message logging;
- generic and selective output caching;
- extensible authentication and authorization;
- security measures such as cross-site script (XSS) prevention, cookie protection, etc.