2017 © Pedro Peláez
 

library superglue

image

topsitemakers/superglue

  • Sunday, November 10, 2013
  • by topsitemakers
  • Repository
  • 2 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Superglue

Legacy PHP "microframework" for quick prototyping

This is basically a modified version of the existing Glue class for mapping URLs to classes. Its purpose is mainly for quick and dead-simple prototyping, with as little overhead as possible.
It does not use any of the PHP 5.3+ features, and should work everywhere with PHP 5.x+ installed., (*1)

Differences between this and the original class are:, (*2)

Shipped with a very simple .htaccess for readable URLs., (*3)

Usage:

You first need to define URLs that will be accessible:, (*4)

require 'superglue.php';

// Define URLs
$urls = array(

  // This will be binded to class "sample" and method "index"
  '/' => 'sample',
  // This will be binded to class "sample" and method "page"
  '/sample' => array('sample', 'page'),

  // RESTful example
  // If we do not pass an array here, superglue will check if the class has
  // method named as the request method (GET, POST, DELETE, PUSH)
  '/restful' => 'restful',

);

Define classes that will be called on appropriate routes:, (*5)

// Our sample class
// Classes are better than direct functions for code organization and for
// avoiding name clashes.
class sample {
  function index() {
    print 'home page';
  }
  function page() {
    print 'sample page';
  }
}

// Example RESTful class
// Each method corresponds with the request method.
class restful {
  function GET() {
    print 'GET method.';
  }
  function POST() {
    print 'POST method.';
  }
  function PUSH() {
    print 'PUSH method.';
  }
  function DELETE() {
    print 'DELETE method.';
  }
}

That's it - start the app!, (*6)

superglue::stick($urls);

Credits

Glue, (*7)


By: topsitemakers.com., (*8)

The Versions

10/11 2013

dev-master

9999999-dev

  Sources   Download

The Requires

  • php >=5.2.0