2017 © Pedro Peláez
 

library asphalte

A micro-routing library for PHP

image

hellointeractiv/asphalte

A micro-routing library for PHP

  • Tuesday, February 27, 2018
  • by hellointeractiv
  • Repository
  • 1 Watchers
  • 0 Stars
  • 38 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 36 % Grown

The README.md

Asphalte

minimal route system class in php Objet, (*1)

Install

Composer

composer require hellointeractiv/asphalte

or bower

"hellointeractiv/asphalte": "2.0.0"

Htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
</IfModule>

Install


require('asphalte.php'); // or require_once("../app/vendor/autoload.php"); $route = new Asphalte;

How to use


# Exemple $result = ""; $result = $route->get('/test', function ($route) { return $route; }); # result return 3 variables in object(stdClass) statut request size and dynamic vars if there is echo $result->statut; echo $result->sizetatut; var_dump($result->request); #or $result = $route->match('GET','/test', "base_controler@test"); # result lunch controler-> function if exeist if($result==""){ echo "404"; }else{ echo $result; } # variables dynamic $result = $route->get('/article/:id', function ($route) { return $route; }); echo $result->id; # return 3 variables in object(stdClass) statut request and dynamic vars # # object(stdClass)(3) { # ["statut"]=>bool(true), # ["request"]=>array(2) { # [0]=>string(7) "article" # [1]=>string(4) "test" # }, # ["size"]=>2, # ["id"]=>string(4) "test" # } $route->get_map("test/:id"); #object(stdClass) (3) { # ["method"]=>string(3) "get" # ["request"]=> # array(2) { # [0]=>string(4) "test" # [1]=>string(4) "ouoi" # } # ["size"]=>int(2) # } #route can be have many vars in array ) if( $route->get(... if( $route->post(... if( $route->any(...

REST

if( $route->put(...

if( $route->delete(...

The Versions

27/02 2018

dev-master

9999999-dev https://github.com/hellointeractiv/asphalte

A micro-routing library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

1.0.0

14/10 2016

2.0.0

2.0.0.0 https://github.com/hellointeractiv/asphalte

A micro-routing library for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

1.0.0