A lightweight router/dispatcher.

0.2.5 2020-09-04 16:13 UTC

This package is auto-updated.

Last update: 2021-05-04 17:50:00 UTC


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.

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


The best way to install Notion is via Composer

Our package is located here

Install Composer

curl -sS | php

Add the Notion Package

php composer.phar require clearidea/notion

Install Later Updates

composer.phar update


This example .htaccess file shows how to get and pass the route to the example application.

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.

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

Route::get( '/',
            echo 'Home Page';

Route::get( '/about',
            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' => $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.