Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sizuhiko/Taste

Taste is custom-loader of CakePHP Application
https://github.com/sizuhiko/Taste

Last synced: 3 months ago
JSON representation

Taste is custom-loader of CakePHP Application

Awesome Lists containing this project

README

        

h1. Taste is bootstrap of CakePHP2 Application for pear/PHP_Shell_

Copyright(c) 2011 Sizuhiko. Licensed under the MIT license.

h2. Overview

PHP_Shell is a interactive PHP Shell with tab-completion, inline help and handling of FATAL errors.
If php installed with configure option --with-readline, I recommend use `php -a`.
But, the configure option is not include, `php -a` is a Intaractive Mode(is not Intaractie Shell).
Taste is bootstrap of CakePHP2.x for PHP_Shell.
It includes and require some CakePHP2.x classes for PHP_Shell.
Taste works like 'Rails c' for your CakePHP2.x application.

h2. Usage

h3. Require

* PHP 5.3.1 or later (5.4 is ready too!)
* pear/PHP_Shell
** http://pear.php.net/package/PHP_Shell/
** https://github.com/pear/PHP_Shell
** http://jan.kneschke.de/projects/php-shell/
* CakePHP 2.x (if you use CakePHP1.3, please check tags)

h3. Install

Install PHP_Shell pear package.



pear install PHP_Shell-0.3.1

Copy taste.php to under the root directory of CakePHP.



ls
app index.php lib plugins taste.php vendors

The initial install is an end.

h3. Let's execute it.

Move to the directory including cake, app, and vendors, and next, execute the following commands.



$ php-shell.sh
PHP-Shell - Version 0.3.1
(c) 2006, Jan Kneschke

>> use '?' to open the inline help

>> r taste.php

h2. Example usage

You can use CakePHP2.x core classes and your application classes.

h3. Using Models



>> $post = ClassRegistry::init('Post');
>> $data = $post->find('all');
array (
0 =>
array (
'Post' =>
array (
'id' => '1'
'title' => 'The title'
'body' => 'This is the post body.'
'created' => '2011-06-18 20:30:35'
'modified' => NULL
),
),
1 => ....

h3. Dispatch URL



>> $dispatcher = new Dispatcher();
>> $request = new CakeRequest('/posts');
>> $response = new CakeResponse();
>> $dispatcher->dispatch($request, $response);


CakePHP: the rapid development php framework: Posts




Blog posts

Id
Title
Created

1

Title
2011-06-18 20:30:35

h3. Using Router



>> Router::url(array('controller'=>'posts', 'action'=>'index'), false);
'/posts'