{@head.html}
{@navigation.html}Breeze was designed to be simple and flexible. Let's check it out.
Like many others frameworks Breeze expect some predefeind folders structure of your project. But comparing to other player it's not that complex:
File/Path | Description |
---|---|
/.htaccess |
Typical "rewriter" RewriteEngine On RewriteRule gif$ - [L] RewriteRule css$ - [L] RewriteRule jpg$ - [L] RewriteRule jpeg$ - [L] RewriteRule js$ - [L] RewriteRule swf$ - [L] RewriteRule png$ - [L] RewriteRule ico$ - [L] RewriteRule avi$ - [L] RewriteRule htc$ - [L] RewriteRule flv$ - [L] RewriteRule wmv$ - [L] RewriteRule .* index.php |
/index.php |
Just include Breeze main file require_once(dirname(__FILE__).'/breeze/Breeze.php'); Honestly saying - that's all we need. You can start creating your application right after this line. require_once(dirname(__FILE__).'/breeze/Breeze.php'); // here we can put our application code But we suggest you to put your application code into /app folder. If this folder exists - Breeze will look into following file: |
/app/index.php |
Default main application entry point |
/config.php |
Configuration file. Optional, but almost every application have some settings. We suggest you to put at least one line into this file: br()->defaultConfig();
|
That's all. We all set. If you put
echo('Hello World');into your
/app/index.php
you will see your first Breeze application.
If you don't need Breeze as framework you can still use it's nice functions and helpers. Just include it into your script:
require_once('/breeze/Br.php');
And use magic br() function to access Breeze helpers.
Breeze have 3 key components:
Let's start from br(). Idea of Breeeze is ability to use it anywhere - as separate application or as part of existing app. That's why all Breeze components accessible via br() function.
List of functions you can check later in documentation, currently we will see how to use br()->request() to implement routing
Routing handled by BrRequest class. You can access it's instance via br()->request() function. Let's see how to handle differend kind of requests.
br() ->request() ->route('/index.html', function() { // display homepage }) ->route('/order.html?client=([0-9]+)', function($matches) { // display order of client $matches[1] }) ->routeGET('/pay.html', function() { // display payment page }) ->routePOST('/pay.html', function() { // handle POST to pay.html }) ->routeIndex(function() { // handle request to root url of your site }) ->routeDefault() ;
Once some of the routes processed - other ones will be skipped. Simple, isn't it?