Web Gear is a free, lightweight open source web development platform written in PHP, aimed at developing fast web applications, based on a well defined MVC structure.

Introduction

Installation

Installing the Web Gear Development Platform has never been easier. First of all, you have to download the latest distribution available. After doing that, just unzip the contents of the archive somewhere within your document root and rename the webgear-base directory to what ever you want.

If you put the contents of the webgear-base directory directly into your document root (as defined by apache or which ever web server you use), then you're all done. Otherwise, you only have to make a small change to the includes/config/defs.php file. First find this line:

define('BASE_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/');

and change it following this rule (replacing your_directory with the actual directory name on the disk):

define('BASE_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/your_directory/');

Congratulations! You have successfully installed the Web Gear Development Platform!

Additional configuration

All the configuration settings are defined into the includes/config/defs.php file. They're names are very expressive, so that if you want to change a setting, you don't need to look into a dictionary to do that. The most used settings are explained here, just to get you started.

First of all, you might want to change the setting below to match your application name (which will be included by default in all page titles, unless you modify the header templates):

define('APPLICATION_NAME', 'Default Application');

Debug settings

If the debug mode is turned on, you will see every notice, warning and/or error your application has. You can turn on and off the debug state by changing the setting below to true or false.

define('DEBUG_MODE', true);

By default, general script failures will not be shown. By general script failures we mean startup errors that are treated using exceptions (like an invalid controller or action is requested, or a library cannot be loaded). Instead, a not found page will be shown (which you can customize in the templates/PageNotFound/Index.html file. Parse errors, notices and warnings are always shown, when debug mode is on. Remember to set this to true when going live, so that you'll not stand and watch at a blank page if something goes wrong.

define('DISPLAY_404_CUSTOM_PAGE', true);

Mod_rewrite

By default, you will have some sort of search engine friendly URLs, which are calculated by putting together the controller name and the controller action that is to be called.

We also provide you a very basic rewriting engine, if you want to have more control over your page naming, which you can customize in the file defined for routes (includes/config/routes.ini is the default file for that). This file has to stay into the includes/config/ directory and MUST be an ini file!

define('ROUTES_CONFIG_FILE', 'routes.ini');

You can add your own rules in it, following the pattern below. The only disadvantage is that you can only use a single level of files (meaning that you can have links like yoursite.com/index.php/file.html, but you can't have links like yoursite.com/index.php/some/directory/file.html).

[yourpage.html]
controller = ControllerName
action = ActionToCall
title = "Your page title"

If you have the mod_rewrite Apache module installed on your server, then you have to turn on the setting below, in order to get clean links (without index.php in them) from the links helper.

define('MOD_REWRITE_ENABLED', true);

Here are the settings that MUST go into your .htaccess file defined for your application:

Options +FollowSymLinks

RewriteEngine On
RewriteCond $1 !^(index\.php|admin|resources|uploads|robots\.txt|sitemap\.xml)
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

NOTE that you can't access other paths via URL than the ones defined in the third rule. If you need to have a downloads directory that you need to make available for everyone, just add |downloads after all the files in the third .htaccess rule. Don't forget to escape any non-letter character with a backslash (except the pipe separators, of course).

Other settings

Usually, you will not need to change the application paths. However, if you want to use other paths than the default ones, you can find all the definitions under the PATH CONSTANTS section of the configuration file. If you do that, remember to also get the URL CONSTANTS in sync with the new paths.

All the other settings are explained in they're specific section. Template settings can be found in the Template library documentation, for example, session settings in the Session library documentation, and so on.