noodlehaus/dispatch

namespace

Closed this issue · 1 comments

Please add Namespace in dispatch.php

Reason
Avoid function name conflict.
Right now we can not create another function with the name that already exists in dispatch.

Solution
Add Namespace

// dispatch.php
<?php
namespace Dispatch;
?>

Usage

<?php
include '../../src/dispatch.php';
use Dispatch as app;

app\on('GET', '/index', function () {
  echo "GET /index invoked";
});

app\dispatch();
?>

Hi Munza. Sorry but Dispatch's lack of namespace is intentional, and it's something that I don't intend to add. At least, not for now.