PHP code example of eril / uri-mapper

1. Go to this page and download the library: Download eril/uri-mapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eril / uri-mapper example snippets


Uri::home();      // /
Uri::services();  // /services/
Uri::admin();     // /admin/


// @route dashboard


<!-- @route dashboard  --->
 


Uri::signin(); // preferred
Uri::login();  // alias, still works

Uri::home('services');   // /services/
Uri::admin('users');    // /admin/users/

Uri::admin('/users');
// /admin/users

Uri::admin('/users/{id}', ['id' => 1]);
// /admin/users/1

Uri::admin('/users', ['page' => 2]);
// /admin/users?page=2

Uri::home();
Uri::admin('users');
Uri::services(['page' => 2]);

Uri::uri();   // current request URI
Uri::url();   // full URL
Uri::param(); // GET parameters

routes/
├── index.php
├── services/
│   └── index.php
├── admin/
│   ├── index.php
│   └── users.php

/login/index.php   // @route signin
bash
vendor/bin/uri-mapper ./routes --php