2017 © Pedro Peláez
 

library router

Route the URL variables to your project

image

codedgr/router

Route the URL variables to your project

  • Wednesday, June 6, 2018
  • by codedgr
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Router

Route the URL variables to your project, (*1)

Install

Add the following to your .htaccess file in order to redirect everything to the index.php file., (*2)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ index.php

Build the URL

Define PARSE_URL with your domain name:, (*3)

define('PARSE_URL','https://www.example.gr')

Use the url() function with as many attributes you want., (*4)

$url = Parse::url('class', 'method', ['var'=>'foo','foo'=>'boo']);

the above example will output, (*5)

https://www.example.gr/class/method/var=foo&foo=boo

Parse variables from a URL

Contract the Parse object passing the URL and use the get method to get an array of variables., (*6)

$array = (new Parse($url))->get();

If we use the previous URL, this example will output, (*7)

Array
(
    [0] => class
    [1] => method
    [2] => Array
        (
            [var] => foo
            [foo] => boo
        )

)

You may also pass which key your want get, (*8)

$var = (new Parse($url))->get(1);

If we use the previous URL, this example will output a string method or false if there is no value, (*9)

The Versions

06/06 2018

dev-master

9999999-dev https://github.com/codedgr/router

Route the URL variables to your project

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

The Development Requires

router

06/06 2018

1.0.0

1.0.0.0 https://github.com/codedgr/router

Route the URL variables to your project

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

The Development Requires

router