All Projects → BaguettePHP → TetoRouting

BaguettePHP / TetoRouting

Licence: other
Simple routing for WebApp

Programming Languages

PHP
23972 projects - #3 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to TetoRouting

auth0-django-web-app
Auth0 Integration Samples for Django Web Applications
Stars: ✭ 33 (+94.12%)
Mutual labels:  webapp
Edite
📸 Your new Photoshop
Stars: ✭ 17 (+0%)
Mutual labels:  webapp
yii2-fullcalendar
Yii 2 component for easy fullcalendar integration
Stars: ✭ 21 (+23.53%)
Mutual labels:  packagist
photochat
Works cool: I use a secure app to chat. Next level: I encrypt my chats with a private key. Intergalactic level: I encrypt my chats with a one-time token and then make them deceptively public ;)
Stars: ✭ 38 (+123.53%)
Mutual labels:  webapp
salati
A small web app for prayers times in cities of Morocco
Stars: ✭ 14 (-17.65%)
Mutual labels:  webapp
node-starter-kit
Node.js / GraphQL project template pre-configured with TypeScript, PostgreSQL, login flow, transactional emails, unit tests, CI/CD workflow.
Stars: ✭ 76 (+347.06%)
Mutual labels:  webapp
play-scala-secure-session-example
An example Play application showing encrypted session management
Stars: ✭ 54 (+217.65%)
Mutual labels:  webapp
Image-to-Braille
Give it an image, and it will become unicode braille
Stars: ✭ 140 (+723.53%)
Mutual labels:  webapp
go-web-app-antipatterns
Short examples of common anti-patterns in Go Web Applications.
Stars: ✭ 163 (+858.82%)
Mutual labels:  webapp
englishextra.github.io
English Grammar for Russian-Speakers, a PWA website + SPA
Stars: ✭ 19 (+11.76%)
Mutual labels:  webapp
SyncPaint
A web app for synchronized group drawing. Draw together with other people in real time.
Stars: ✭ 42 (+147.06%)
Mutual labels:  webapp
servant-beam-realworld-example-app
Exemplary fullstack Medium.com clone powered by Servant and Beam
Stars: ✭ 33 (+94.12%)
Mutual labels:  webapp
appleauth-net
AppleAuth.NET is a simple library that facilitates the implementation of "Sign in with Apple" for .NET applications.
Stars: ✭ 23 (+35.29%)
Mutual labels:  webapp
weapp-lolgame
微信小程序,微信小应用-英雄联盟(LOL)战绩查询
Stars: ✭ 64 (+276.47%)
Mutual labels:  webapp
WF WebBasedFileBrowser
A user-friendly Web File Browser.一款 易用性强 快速部署美观的网页文件管理器.
Stars: ✭ 93 (+447.06%)
Mutual labels:  webapp
java-signin
Java实现的(软件或网络)实验室的Web签到系统,签到原理基于IP和座位的(强制)对应关系。
Stars: ✭ 17 (+0%)
Mutual labels:  webapp
ESPecial
ESP32 automation with web interface and telegram bot
Stars: ✭ 77 (+352.94%)
Mutual labels:  webapp
ngxp-quotes-app
Cross Platform Quotes Application built with Angular and Nativescript.
Stars: ✭ 26 (+52.94%)
Mutual labels:  webapp
pytorch-serving
[UNMAINTAINED] A starter pack for creating a lightweight responsive web app for Fast.AI PyTorch models.
Stars: ✭ 16 (-5.88%)
Mutual labels:  webapp
svelte-electron-boilerplate
🧬 Create a desktop app with this user-friendly Svelte boilerplate for electron
Stars: ✭ 70 (+311.76%)
Mutual labels:  webapp

Teto Routing - PHP simple router

Join the chat at https://gitter.im/BaguettePHP/simple-routing Package version Build Status Packagist Scrutinizer Code Quality Code Coverage

Simple routing for WebApp

No magic. No reflection. No complex dependency.

Installation

Composer

composer require zonuexe/simple-routing

References

Routing DSL

//    Method      Path           ReturnValue  Param => RegExp     extension (format)
$routing_map = [
    ['GET',      '/',            'index'  ],
    ['GET|POST', '/search',      'search' ],
    ['GET',      '/article/:id', 'article',  ['id' => '/\A(\d+)\z/'], '?ext' => ['', 'txt']],
    ['GET',      '/info',        'feed' ,                             '?ext' => ['rss', 'rdf', 'xml']],
     '#404'       =>             'not_found' // special
];

$router = new \Teto\Routing\Router($routing_map);
$action = $router->match($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);

// Shorthand (but, do not use reverse routing)
$action = \Teto\Routing\Router::dispatch($routing_map, $_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);

Reverse routing

//   Name         Method      Path            ReturnValue  Param => RegExp     extension (file format)
$routing_map = [
    'root'    => ['GET',      '/',            'index'  ],
    'search'  => ['GET|POST', '/search',      'search' ],
    'article' => ['GET',      '/article/:id', 'article',  ['id' => '/\A(\d+)\z/'], '?ext' => ['', 'txt']],
    'info'    => ['GET',      '/info',        'feed' ,                             '?ext' => ['rss', 'rdf', 'xml']],
    '#404'    =>                              'not_found' // special
];

$router = new \Teto\Routing\Router($routing_map);

$router->makePath('root');    //=> '/'
$router->makePath('search');  //=> '/search'
$router->makePath('article', ['id' => 123]);     //=> '/article/123'
$router->makePath('info',    ['?ext' => 'rss']); //=> '/info.rss'

Tips

$re_num_id    = '/\A(\d+)\z/';
$re_user_name = '/\A@([a-z]+)\z/';

$routing_map = [
    'root'    => ['GET', '/',            'index'  ],
    'search'  => ['GET', '/search',      'search' ],
    'article' => ['GET', '/article/:id', 'article',  ['id' => $re_num_id], '?ext' => ['', 'txt']],
    '#404'    =>                         'not_found' // special
];

Related Libraries

You can get these libraries from Packagist.

Copyright

Teto\Routing is licensed under Apache License Version 2.0. See ./LICENSE.

Teto Routing - PHP simple router for WebApp
Copyright (c) 2016 Baguette HQ / USAMI Kenta <[email protected]>

Teto Kasane

I love Teto Kasane. (ja: Teto Kasane official site)

       r /
  __ , --ヽ!-- .、_
 !  `/::::;::::ヽ l
 !二二!::/}::::丿ハニ|
 !ニニ.|:/ ノ/ }::::}コ
 L二lイ  0´ 0 ,':ノコ
 lヽノ/ヘ、 '' ▽_ノイ ソ
  ソ´ /}`ス / ̄ ̄ ̄ ̄/
   .(_:;つ/  0401 / カタカタ
  ̄ ̄ ̄ ̄ ̄\/____/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].