Commit: f5e8d1be32fee4c3c33c5604468ffd6a3a09bf43

Author: gwoo | Date: 2009-10-29 02:20:52 -0700
updating source
diff --git a/exceptions/NotFoundException.php b/exceptions/NotFoundException.php index 3e43237..1748e22 100644 --- a/exceptions/NotFoundException.php +++ b/exceptions/NotFoundException.php @@ -1,6 +1,6 @@ <?php -namespace slice\exceptions; +namespace li3_ion\exceptions; class NotFoundException extends \Exception { } diff --git a/extensions/http/Dispatcher.php b/extensions/http/Dispatcher.php index 474c3f4..4be4d7c 100644 --- a/extensions/http/Dispatcher.php +++ b/extensions/http/Dispatcher.php @@ -1,12 +1,12 @@ <?php -namespace slice\extensions\http; +namespace li3_ion\extensions\http; -class Dispatcher extends \cake\http\Dispatcher { +class Dispatcher extends \lithium\action\Dispatcher { protected static $_classes = array( - 'request' => '\slice\extensions\http\Request', - 'router' => '\slice\extensions\http\Router' + 'request' => '\li3_ion\extensions\http\Request', + 'router' => '\li3_ion\extensions\http\Router' ); public static function run($request, $options = array(), $methods = array()) { diff --git a/extensions/http/Request.php b/extensions/http/Request.php index 1118a68..54611f5 100644 --- a/extensions/http/Request.php +++ b/extensions/http/Request.php @@ -1,8 +1,8 @@ <?php -namespace slice\extensions\http; +namespace li3_ion\extensions\http; -class Request extends \cake\http\Request { +class Request extends \lithium\action\Request { public function __get($key) { return isset($this->params[$key]) ? $this->params[$key] : $this->env($key); diff --git a/extensions/http/Router.php b/extensions/http/Router.php index 7afbc89..845d9b6 100644 --- a/extensions/http/Router.php +++ b/extensions/http/Router.php @@ -1,8 +1,8 @@ <?php -namespace slice\extensions\http; +namespace li3_ion\extensions\http; -class Router extends \cake\http\Router { +class Router extends \lithium\http\Router { protected static $_configuration = array(); diff --git a/readme b/readme index 4d01e71..01ff820 100644 --- a/readme +++ b/readme @@ -1,21 +1,21 @@ -## Slice: The Lightweight Request Dispatch Framework for CakePHP +## Ion: The Lightweight Request Dispatch Framework for Lithium -Slice is a plugin which allows you to implement micro-applications or application services using the CakePHP framework. Slice is ideally suited to serving small requests, such as APIs or Ajax queries, where speed is of the essence. +Ion is a plugin which allows you to implement micro-applications or application services using the Lithium framework. Ion is ideally suited to serving small requests, such as APIs or Ajax queries, where speed is of the essence. -To use Slice in your application, simply install it in your `plugins` directory and include it by adding the following to `config/bootstrap.php` or `webroot/index.php`: +To use Ion in your application, simply install it in your `plugins` directory and include it by adding the following to `config/bootstrap.php` or `webroot/index.php`: {{{ -\cake\core\Libraries::add('plugin', 'slice'); +\lithium\core\Libraries::add('plugin', 'li3_ion'); }}} -You can then implement Slice services by calling the `run()` method of `slice\extensions\http\Dispatcher`, and passing it an array where the keys are Slice-formatted routes and the values are closures which define how requests matching the corresponding route should be handled. +You can then implement Ion services by calling the `run()` method of `li3_ion\extensions\http\Dispatcher`, and passing it an array where the keys are Ion-formatted routes and the values are closures which define how requests matching the corresponding route should be handled. {{{ use \Exception; use \app\models\Post; -use \slice\exceptions\NotFoundException; -use \slice\extensions\http\Dispatcher; +use \li3_ion\exceptions\NotFoundException; +use \li3_ion\extensions\http\Dispatcher; echo Dispatcher::run(array( 'get /posts/{:id:\d+}.json' => function($request) { @@ -35,12 +35,12 @@ echo Dispatcher::run(array( ### Routing -The syntax for declaring routes in Slice is similar to that of Cake 3.0 standard routes, except that Slice routes are prefixed with an HTTP request method name, followed by a space. Routes can then include standard parameters, with optional regular expression match patterns, as in the example. +The syntax for declaring routes in Ion is similar to that of Lithium standard routes, except that Ion routes are prefixed with an HTTP request method name, followed by a space. Routes can then include standard parameters, with optional regular expression match patterns, as in the example. ### Handling requests -Closures used to handle requests in Slice take a single parameter, an instance of the `Request` object, which encapsulates the request details. Slice extends the default CakePHP `Request` object so that route parameters are accessible as properties (i.e. `$request->id`), as seen in the example. +Closures used to handle requests in Ion take a single parameter, an instance of the `Request` object, which encapsulates the request details. Ion extends the default Lithium `Request` object so that route parameters are accessible as properties (i.e. `$request->id`), as seen in the example. -In order to successfully handle requests, closures must _either_ return an array containing (at a minimum) `'status'`, `'type'`, and `'content'` keys, and optionally, a `'headers'` key containing an array with additional headers, _or_ an instance of `cake\http\Response` containing a fully-formed response. +In order to successfully handle requests, closures must _either_ return an array containing (at a minimum) `'status'`, `'type'`, and `'content'` keys, and optionally, a `'headers'` key containing an array with additional headers, _or_ an instance of `lithium\action\Response` containing a fully-formed response. -Alternatively, closures can throw exceptions in case of error, or ignore the request, simply by returning null. If a request is ignored, it simply "falls through", out of the scope of Slice. This is useful if you are declaring a Slice service inside of `webroot/index.php`, and wish for requests ignored by Slice to be handled by your application. \ No newline at end of file +Alternatively, closures can throw exceptions in case of error, or ignore the request, simply by returning null. If a request is ignored, it simply "falls through", out of the scope of Ion. This is useful if you are declaring a Ion service inside of `webroot/index.php`, and wish for requests ignored by Ion to be handled by your application. \ No newline at end of file