Overview

Packages

  • tipy

Classes

  • Tipy
  • TipyApp
  • TipyCli
  • TipyCliSession
  • TipyConfig
  • TipyController
  • TipyCookie
  • TipyDAO
  • TipyEnv
  • TipyFlash
  • TipyInflector
  • TipyInput
  • TipyIOWrapper
  • TipyLogger
  • TipyMailer
  • TipyModel
  • TipyOutput
  • TipyRequest
  • TipySession
  • TipyTestCase
  • TipyTestRunner
  • TipyView

Exceptions

  • AssertionFailedException
  • CompileErrorException
  • CompileWarningException
  • CoreErrorException
  • CoreWarningException
  • DeprecatedException
  • NoMethodException
  • NoticeException
  • ParseException
  • RecoverableErrorException
  • StrictException
  • TipyDaoException
  • TipyException
  • TipyModelException
  • TipyRollbackException
  • TipyValidationException
  • UserDeprecatedException
  • UserErrorException
  • UserNoticeException
  • UserWarningException
  • WarningException
  • Overview
  • Package
  • Class
  • Deprecated
  • Todo
  1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 
<?php
/**
 * tipy : Tiny PHP MVC framework
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @package       tipy
 * @copyright     Copyright (c) 2008-2015 Serge Smetana <serge.smetana@gmail.com>
 * @copyright     Copyright (c) 2008-2015 Roman Zhbadynskyi <zhbadynskyi@gmail.com>
 * @link          https://github.com/smetana/tipy
 * @author        Serge Smetana <serge.smetana@gmail.com>
 * @author        Roman Zhbadynskyi <zhbadynskyi@gmail.com>
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */

define('CLI_MODE', php_sapi_name() == 'cli');

// Require base classes
require_once('src/TipyErrorHandler.php');
require_once('src/TipyLogger.php');
require_once('src/TipyIOWrapper.php');
require_once('src/TipyConfig.php');
require_once('src/TipyRequest.php');
require_once('src/TipyEnv.php');
require_once('src/TipyCookie.php');
require_once('src/TipyInput.php');
require_once('src/TipyOutput.php');
require_once('src/TipySession.php');
require_once('src/TipyMailer.php');
require_once('src/TipyDAO.php');
require_once('src/TipyInflector.php');
require_once('src/TipyModel.php');
require_once('src/TipyView.php');
require_once('src/TipyFlash.php');
require_once('src/TipyController.php');
require_once('src/TipyApp.php');
if (CLI_MODE) {
    require_once('src/TipyCli.php');
    require_once('src/TipyCliSession.php');
}

// Convert PHP errors to exceptions
set_error_handler('tipyErrorHandler');

/**
 * Main class to run application
 *
 * <code>
 * // public/dispatcher.php
 * require('Tipy.php');
 * Tipy::run();
 * </code>
 *
 * ## Setup
 *
 * The most easiest way to setup new *tipy* project is to clone
 * {@link 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:
 * <code>
 * dispatcher.php?controller=my&method=my_action&... # => MyController::myAction()
 * </code>
 *
 * *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
 * <code>
 * source_code => SourceCodeController
 * blog_posts  => BlogPostsController
 * </code>
 *
 * *action* parameter represents controller's method with:
 *
 * - snake_case converted to camelCase (first letter in lower case)
 * - plural/singular form is preserved
 *
 * <code>
 * open_source => openSource()
 * show_posts  => showPosts()
 * </code>
 *
 * ## Predefined Routes
 *
 * {@link https://github.com/smetana/tipy-project 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:
 * <code>
 * /: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);
 * </code>
 */
class Tipy {

    public static function run() {
        CLI_MODE && die("TipyApp cannot be run in CLI mode\n");
        ob_start();
        $app = TipyApp::getInstance();
        $app->run();
        ob_end_flush();
    }
}
tipy API documentation generated by ApiGen