2017 © Pedro Peláez
 

library sneeze

A simple php 5.4+ router

image

neverender/sneeze

A simple php 5.4+ router

  • Sunday, March 1, 2015
  • by neverender
  • Repository
  • 1 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Sneeze

Sneeze is a simple php router., (*1)

It uses 5.4+ features such as closure object binding and short array syntax., (*2)

Requirements

php >= 5.4.0, (*3)

Installation

Use Composer, (*4)

Example

Instantiate Sneeze application:, (*5)

$app = new \Sneeze\Sneeze;

Define an HTTP GET route:, (*6)

$app->get('/hello/:name', function($name) {
  echo "hello $name";
});

Run it:, (*7)

$app->run();

More

You can also define PUT, POST and DELETE HTTP routes. Since modern browsers don't support PUT and DELETE, you can fake it by doing a POST request and adding a "_METHOD" parameter like so:, (*8)

<form action="/put/route/1" method="post">
    <input type="hidden" name="_METHOD" value="PUT"/>
    <!-- other stuff -->
</form>

Inside routes, you have access to $this->request, which is an associative array of the usual request variables including 'get', 'post', 'uri', 'method', 'body', etc., (*9)

TODO

  • Tests
  • Refactor to make it more testable

The Versions

01/03 2015

dev-master

9999999-dev https://github.com/neverender/sneeze

A simple php 5.4+ router

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Nicholas Bernardi

microframework router