Class Tipy
Main class to run application
// public/dispatcher.php require('Tipy.php'); Tipy::run();
Setup
The most easiest way to setup new tipy project is to clone https://github.com/smetana/tipy-project repository. It is an empty tipy aplication skeleton
Routing
Tipy uses .htaccess .htaccess for routing. .htaccess' RewriteRules rewrite all request urls to something like:
dispatcher.php?controller=my&method=my_action&... # => MyController::myAction()
All query string parameters are preserved on url rewite.
controller parameter represents controller class with:
- snake_case converted to CamelCase (first letter in upper case)
- plural/singular form is preserved
- word "Controller" is added to the end
source_code => SourceCodeController blog_posts => BlogPostsController
action parameter represents controller's method with:
- snake_case converted to camelCase (first letter in lower case)
- plural/singular form is preserved
open_source => openSource() show_posts => showPosts()
Predefined Routes
tipy-project has a set of predefined rules so you don't need to rewrite urls to dispatcher.php. It is enough to rewrite urls to one of the following form:
/:controller # /source_code => SourceCodeController::index(); /:controller/:action # /source_code/open_source => SourceCodeController::openSource(); /:controller/:action/:id # /source_code/line_number/3 => SourceCodeController::lineNumber($id = 3);
Package: tipy
Copyright: Copyright (c) 2008-2015 Serge Smetana serge.smetana@gmail.com
Copyright: Copyright (c) 2008-2015 Roman Zhbadynskyi zhbadynskyi@gmail.com
License: MIT License
Author: Serge Smetana serge.smetana@gmail.com
Author: Roman Zhbadynskyi zhbadynskyi@gmail.com
Located at Tipy.php
Copyright: Copyright (c) 2008-2015 Serge Smetana serge.smetana@gmail.com
Copyright: Copyright (c) 2008-2015 Roman Zhbadynskyi zhbadynskyi@gmail.com
License: MIT License
Author: Serge Smetana serge.smetana@gmail.com
Author: Roman Zhbadynskyi zhbadynskyi@gmail.com
Located at Tipy.php
public static
|