Added namespacing

This commit is contained in:
SteamPixel 2020-01-14 10:42:38 +01:00
parent 6674759d96
commit 545d321e0d
3 changed files with 10 additions and 3 deletions

View File

@ -12,6 +12,7 @@ The third argument will match the request method. The default method is 'get'.
## Simple example:
```php
use SteamPixel\Route;
include 'Route.php';
Route::add('/user/([0-9]*)/edit', function($id) {

View File

@ -1,4 +1,7 @@
<?php
namespace SteamPixel;
class Route {
private static $routes = Array();

View File

@ -1,5 +1,11 @@
<?php
// Use this namespace
use SteamPixel\Route;
// Include router class
include 'Route.php';
function navi() {
echo <<<EOD
Navigation:
@ -23,9 +29,6 @@ function navi() {
EOD;
}
// Include router class
include 'Route.php';
// Add base route (startpage)
Route::add('/', function() {
navi();