Download the PHP package sigareng/nam without Composer
On this page you can find all versions of the php package sigareng/nam. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package nam
Short Description Nam is a open source PHP router. super small, fast, and powerful, micro-framework
License MIT
Homepage https://github.com/sigareng/nam
Informations about the package nam
Nam
Nam is a open source PHP router. super small, fast, and powerful. micro-framework
Install
Just Copy clone or copy nam.php in directory
wget https://raw.githubusercontent.com/sigareng/nam/master/nam.php
If you have Composer, just include Nam as a project dependency in your composer.json.
with
or with command line
Examples Used
First, use the sigareng\Nam namespace:
if clone child folder dont forget to call
Nam is not an object, so you can just make direct operations to the class. Here's the Hello World:
like this
index.php
with composer
Nam also supports lambda URIs, such as:
You can also make requests for HTTP methods in Nam, so you could also do:
View Renderer
assumed directory layout
.
├── nam.php
├── view
├── head.php
├── body.php
├── footer.php
└── index.php
and inside hi.php
to test after clone this repository, run
php -S localhost:8080and gotohttp://localhost:8080/Example/on browser
Error Handling
You can pass a message into the exception that will be displayed in place of the default message on the 404 page.
If you don't specify an error callback, Nam will just echo 404.
to direct properly without .php extension
example configuration files.
Example passing to a controller instead of a closure
index.php:
see.php:
see so simple to use
.htaccess(Apache):
.htaccess(Nginx):