2017 © Pedro Peláez
 

library notion

A lightweight router/dispatcher.

image

clearidea/notion

A lightweight router/dispatcher.

  • Tuesday, June 5, 2018
  • by ljonesfl
  • Repository
  • 3 Watchers
  • 0 Stars
  • 47 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 15 Versions
  • 15 % Grown

The README.md

Notion

Notion is a lightweight router/dispatcher is the vein of Ruby's Sinatra or Python's Flask. It allows for a very quick method for creating an app using restful routes or to add them to an existing application., (*1)

  • Easily map restful http requests to functions.
  • Extract one or many variables from routes using masks.
  • Create custom 404 responses.

Installation

The best way to install Notion is via Composer, (*2)

Our package is located here, (*3)

Install Composer, (*4)

curl -sS https://getcomposer.org/installer | php

Add the Notion Package, (*5)

php composer.phar require clearidea/notion

Install Later Updates, (*6)

composer.phar update

.htaccess

This example .htaccess file shows how to get and pass the route to the example application., (*7)

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?route=$1 [L,QSA]

Example App

Here is an example of a fully functional application that processes several routes including one with a variable., (*8)

<?php
require_once '../vendor/autoload.php';

Route::get( '/',
        function()
        {
            echo 'Home Page';
        }
    );

Route::get( '/about',
        function()
        {
            echo 'About Page';
        }
    );

Route::get( '/test/:name',
        function( $parameters )
        {
            echo "Name = $parameters[name]";
        }
    );

Route::get( '/404',
        function( $parameters )
        {
            echo "No route found for $parameters[route]";
        }
    );

$Get    = new \Neuron\Data\Filter\Get();
$Server = new \Neuron\Data\Filter\Server();

Route::dispatch(
    [
        'route' => $Get->filterScalar( 'route' ),
        'type'  => $Server->filterScalar( 'METHOD' )
    ]
);

If present, the extra element is merged into the parameters array before it is passed to the routes closure., (*9)

The Versions

05/06 2018

dev-develop

dev-develop

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

05/06 2018

dev-master

9999999-dev

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

05/06 2018

0.2.2

0.2.2.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

23/02 2018

0.2.1

0.2.1.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

23/02 2018

0.2.0

0.2.0.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

18/02 2018

0.1.9

0.1.9.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

16/12 2017

0.1.8

0.1.8.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

16/12 2017

0.1.7

0.1.7.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

16/12 2017

0.1.6.1

0.1.6.1

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

16/12 2017

0.1.5

0.1.5.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

20/11 2017

0.1.4

0.1.4.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

14/09 2016

0.1.3

0.1.3.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

25/08 2016

0.1.2

0.1.2.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

16/08 2016

0.1.1

0.1.1.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones

16/08 2016

0.1.0

0.1.0.0

A lightweight router/dispatcher.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Lee Jones