Skip to content

72squared/glu-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GLU

NAME
    GLU - a lightweight application framework for PHP

SYNOPSIS
    Most applications can be summarized as some variation on: 
        
        INPUT -> PROCESS -> OUTPUT
        
    GLU 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 explain.
        
        $input = new GLU;
        $input->arg1 = 'test';
        $output = $input->dispatch('/path/to/file');
    
DESCRIPTION
    GLU 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 GLU can call another GLU, you can simplify complex tree of decisions into a well
    organized and reusable library of processing instructions.
    here is a simple example:
        
        $output = GLU::instance()->dispatch('/path/to/file');
        
    This command would find a file and include it.
    Each include becomes the body of an anonymous function. 
    
    Because GLU is a container, i can assign stuff to a GLU. These become arguments to the include. 
    When I dispatch it, I can access the assigned variables using syntax like: $this->myvar.
        
         GLU::instance(array('greeting'=>'hi'))->dispatch('test');
         
    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
    GLU was built for php5 or greater. To use GLU, just include the single glu.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 GLU is contained in one very tiny php file.
    
AUTHOR
    John Loehrer <john@72squared.com>
    Send bug reports or comments to the above address.
    

About

A simple php class that can be used to build an entire web application framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages