* * @package Appfuel * @author Robert Scott-Buccleuch <*****@*****.**> * @copyright 2009-2011 Robert Scott-Buccleuch <*****@*****.**> * @license http://www.apache.org/licenses/LICENSE-2.0 */ use Appfuel\Kernel\ConfigBuilder, Appfuel\Kernel\KernelInitializer, Appfuel\Kernel\KernelRegistry; $base = realpath(dirname(__FILE__) . '/../'); $file = "{$base}/lib/Appfuel/Kernel/KernelInitializer.php"; if (!file_exists($file)) { throw new \Exception("Could not find kernel initializer file at {$file}"); } require_once $file; $config = array('main' => array('base-path' => $base, 'enable-autoloader' => true, 'default-timezone' => 'America/Los_Angeles', 'display-errors' => 'on', 'error-reporting' => 'all, strict')); $init = new KernelInitializer($base); $init->initialize('main', $config); $args = $_SERVER['argv']; if (count($args) < 2 || !isset($args[1])) { fwrite(STDERR, "must the env name -(eg. local|dev|qa|production)\n"); exit; } $env = $args[1]; if (!is_string($env) || empty($env)) { fwrite(STDERR, "env must be a non empty string"); exit; } $builder = new ConfigBuilder($env); try { $builder->generateConfigFile(); } catch (Exception $e) { fwrite(STDERR, 'config build failure: ' . $e->getMessage());
* PHP 5.3+ object oriented MVC framework supporting domain driven design. * * @package Appfuel * @author Robert Scott-Buccleuch <*****@*****.**> * @copyright 2009-2010 Robert Scott-Buccleuch <*****@*****.**> * @license http://www.apache.org/licenses/LICENSE-2.0 */ use Appfuel\Http\HttpOutput, Appfuel\Http\HttpResponse, Appfuel\Kernel\KernelInitializer, Appfuel\Kernel\Mvc\MvcFactoryInterface, Appfuel\Kernel\Mvc\MvcRouteDetailInterface; $base = realpath(dirname(__FILE__) . '/../'); $file = "{$base}/lib/Appfuel/Kernel/KernelInitializer.php"; if (!file_exists($file)) { throw new LogicException("Could not find kernel initializer file at {$file}"); } require_once $file; $init = new KernelInitializer($base); $factory = $init->initialize('main')->createMvcFactory(); if (!$factory instanceof MvcFactoryInterface) { $err = "mvc factory must implment Appfuel\\Kernel\\Mvc\\MvcFactoryInterface"; throw new LogicException($err); } /* * parse view format out of the route key: takes the form route-key.format * ex) my-route-key.json */ $uri = $factory->createUriFromServerSuperGlobal(); $key = $uri->getRouteKey(); $parts = explode('.', $key); $key = current($parts); $format = strtolower(next($parts)); if (empty($format)) { $format = 'html';
* * @package Appfuel * @author Robert Scott-Buccleuch <*****@*****.**> * @copyright 2009-2011 Robert Scott-Buccleuch <*****@*****.**> * @license http://www.apache.org/licenses/LICENSE-2.0 */ use Appfuel\Kernel\KernelInitializer, Appfuel\Kernel\Mvc\MvcContextBuilder, Appfuel\Kernel\Mvc\MvcFactoryInterface, Appfuel\Kernel\Mvc\MvcRouteDetailInterface; $base = realpath(dirname(__FILE__) . '/../../'); $file = "{$base}/lib/Appfuel/Kernel/KernelInitializer.php"; if (!file_exists($file)) { throw new \Exception("Could not find kernel initializer file at {$file}"); } require_once $file; $config = array('main' => array('base-path' => $base, 'enable-autoloader' => true, 'default-timezone' => 'America/Los_Angeles', 'display-errors' => 'on', 'error-reporting' => 'all, strict')); $init = new KernelInitializer($base); $factory = $init->initialize('main', $config)->createMvcFactory(); if (!$factory instanceof MvcFactoryInterface) { $err = "mvc factory must implment Appfuel\\Kernel\\Mvc\\MvcFactoryInterface"; throw new LogicException($err); } if (count($argv) < 2) { $err = "fuelcell cli must have a route as its first argument"; fwrite(STDERR, $err); exit(1); } $routeStr = $argv[1]; $uri = $factory->createUri($routeStr); $key = $uri->getRouteKey(); $parts = explode('.', $key); $key = current($parts); $format = strtolower(next($parts));
<?php /** * Appfuel * PHP object oriented MVC framework use to support developement with * doman driven design. * * @package Appfuel * @author Robert Scott-Buccleuch <*****@*****.**> * @copyright 2009-2010 Robert Scott-Buccleuch <*****@*****.**> * @license http://www.opensource.org/licenses/bsd-license.php BSD License */ use Appfuel\Kernel\KernelInitializer; $base = realpath(dirname(__FILE__) . '/../'); $file = "{$base}/lib/Appfuel/Kernel/KernelInitializer.php"; if (!file_exists($file)) { throw new \Exception("Could not find kernel initializer file at {$file}"); } require_once $file; $init = new KernelInitializer($base); $init->initialize('test')->runStartupTasks(); unset($file); unset($base);