This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
John Loehrer (author)
Thu Jun 19 07:29:08 -0700 2008
grok-php /
| name | age | message | |
|---|---|---|---|
| |
LICENSE | Fri Jun 13 07:56:53 -0700 2008 | [John Loehrer] |
| |
README | Thu Jun 12 21:14:54 -0700 2008 | [John Loehrer] |
| |
TODO | Fri Jun 13 08:52:29 -0700 2008 | [John Loehrer] |
| |
examples/ | Tue Jun 17 12:00:10 -0700 2008 | [John Loehrer] |
| |
grok.php | Thu Jun 19 07:29:08 -0700 2008 | [John Loehrer] |
| |
tests/ | Fri Jun 13 07:46:51 -0700 2008 | [John Loehrer] |
README
GROK
NAME
Grok - a lightweight application framework for PHP
SYNOPSIS
Most applications can be summarized as some variation on:
INPUT -> PROCESS -> OUTPUT
Grok allows us to package up our arguments and pass them to a php include file and
retrieve the output. Some sample code might more easily to explain.
$input = new Grok;
$input->arg1 = 'test';
$output = $input->dispatch('/path/to/file.php');
DESCRIPTION
Grok at its most simple is a just a way to pass arguments in a reliable way to a php include.
The class is able to both act as a container and as a dispatcher. In this way, we can reduce
an entire application down to this formula:
INPUT -> PROCESS -> OUTPUT
Because one grok can call another grok, you can simplify complex tree of decisions into a well
organized and reusable library of processing instructions.
here is a simple example:
$output = Grok::instance()->dispatch('/path/to/file.php');
This command would find a file and include it.
Each include becomes the body of an anonymous function.
Because grok is a container, i can assign stuff to a grok. These become arguments to the include.
When I dispatch it, I can access the assigned variables using syntax like: $this->myvar.
Grok::instance(array('greeting'=>'hi'))->dispatch('test.php');
inside the test.php file, i can access the greeting variable by doing:
return $this->greeting;
because dispatch also returns the response from the included file, the dispatch method can act
just like a function.
DEPENDENCIES
Grok was built for php5 or greater. To use Grok, just include the single grok.php file at the
root of this directory. The file can be copied to any location and used as is. It needs no
customization. You don't need any other files. All the rest of the files in this project are
either tests or examples. The entirety of grok is contained in one very tiny php file.
AUTHOR
John Loehrer <john@72squared.com>
Send bug reports or comments to the above address.
For more information, see the Grok homepage at http://github.com/72squared/grok-php/wikis





