#!/usr/bin/php <?php namespace MyApp; define('APPLICATION', 'Application'); define('APP_NS', 'MyApp'); define('APP_FQCN', '/' . APP_NS . '/' . APPLICATION); require_once 'lib/bootstrap.php'; $lepton = new \cherry\Lepton(__FILE__); // We need this to set up a CLI application require_once 'lib/cherry/cli/application.php'; use cherry\Base\Event; class Application extends \cherry\Cli\Application { protected $apppath = null; protected $route = false; protected $config = 'development'; /** * Function to return some basic application information */ function getApplicationInfo() { return array('appname' => 'CherryTool', 'version' => '1.0', 'description' => 'CherryPHP helper tool', 'copyright' => "Copyright (c) 2012, The CherryPHP Project\nDistributed under GNU GPL version 3"); } /** * Init is called when the application is created. This is the perfect place to * register command line arguments, hook events and set up defaults. */ function init() { // Help: -h or --help
<?php /** * CherryPHP MVC Loader Boilerplate * * (c) 2012, The CherryPHP Project * Licensed under the GNU GPL Version 3 */ define('APPLICATION', 'LeptonApplication'); require_once '../lib/cherry/lepton.php'; require_once '../lib/cherry/mvc/application.php'; $lepton = new \cherry\Lepton(__FILE__); $app = new \cherry\Mvc\Application(); $lepton->setApplication($app); $app->run();
<?php define('APPLICATION', 'LeptonApplication'); // Bootstrap if (!@(include_once "lib/bootstrap.php")) { $libpath = getenv('CHERRY_LIB'); if (!$libpath) { fprintf(STDERR, "Define the CHERRY_LIB envvar first."); exit(1); } require_once $libpath . '/lib/bootstrap.php'; } $lepton = new \cherry\Lepton(__FILE__); use cherry\base\Event; use cherry\base\EventEmitter; use cherry\BundleManager; use Cherry\Extension\ExtensionManager; BundleManager::load('cherry.net'); BundleManager::load('cherry.mvc'); BundleManager::load('cherry.crypto'); BundleManager::load('cherry.user'); //ExtensionManager::load('cherrybar'); $rt = \Cherry\Mvc\Router\StaticRoutes::getInstance(); $rt->addRoute('/start/', '\\MyApp\\Controllers\\IndexController:start'); $app = new \cherry\Mvc\Application(); $lepton->runApplication($app); //$lv = new \cherry\mvc\view\LipsumView(); //echo $lv->getViewcontents();