All Projects → zqhong → route

zqhong / route

Licence: MIT license
A fast router for PHP

Programming Languages

PHP
23972 projects - #3 most used programming language

Labels

Projects that are alternatives of or similar to route

stone paper scissor defeator using opencv keras
In this repository i tried to replicate a cool project by a japanese scientist who made a machine which had 100 % accuracy in defeating humans in the game of stone-paper and scissors
Stars: ✭ 22 (-18.52%)
Mutual labels:  fast
better-serializer
General serializer for PHP. An alternative to JmsSerializer.
Stars: ✭ 27 (+0%)
Mutual labels:  fast
base58
Fast implementation of base58 encoding on golang.
Stars: ✭ 121 (+348.15%)
Mutual labels:  fast
natural
Fastest Framework for NodeJS. Written in pure ES6+
Stars: ✭ 30 (+11.11%)
Mutual labels:  fast
FastHttpClient
封装OkHttp3,对外提供了POST请求、GET请求、上传文件、下载文件、https请求、cookie管理等功能
Stars: ✭ 60 (+122.22%)
Mutual labels:  fast
laravel-route-model-autobinding
THIS PACKAGE HAS BEEN DEPRECATED — Automatically bind Eloquent models as route segment variables.
Stars: ✭ 14 (-48.15%)
Mutual labels:  route
DiffEqPhysics.jl
A library for building differential equations arising from physical problems for physics-informed and scientific machine learning (SciML)
Stars: ✭ 46 (+70.37%)
Mutual labels:  fast
zsh-config
Faster and enjoyable ZSH (maybe) !!!
Stars: ✭ 64 (+137.04%)
Mutual labels:  fast
framework
Cygnite PHP Framework- A Modern Toolkit For Web Developers
Stars: ✭ 43 (+59.26%)
Mutual labels:  fast
ImmediateReflection
.NET library that aims to provide faster usage of C# reflection features. Especially the usage of constructor and members accessors (get/set). It also provides an ObjectWrapper object allowing to use Reflection in a faster way. And finally it offers the possibility to create strongly typed delegates.
Stars: ✭ 30 (+11.11%)
Mutual labels:  fast
XDP-Firewall
An XDP firewall that is capable of filtering specific packets based off of filtering rules specified in a config file. IPv6 is supported!
Stars: ✭ 129 (+377.78%)
Mutual labels:  fast
gologger
A concurrent, fast queue/service worker based filesystem logging system perfect for servers with concurrent connections
Stars: ✭ 16 (-40.74%)
Mutual labels:  fast
TypeKitchen
TypeKitchen is a set of small libraries for fast metaprogramming in .NET Standard.
Stars: ✭ 14 (-48.15%)
Mutual labels:  fast
hash-wasm
Lightning fast hash functions using hand-tuned WebAssembly binaries
Stars: ✭ 382 (+1314.81%)
Mutual labels:  fast
komihash
Very fast, high-quality hash function (non-cryptographic, C) + PRNG
Stars: ✭ 68 (+151.85%)
Mutual labels:  fast
react-redux-fork
React Redux, but just up to 98x faster. (Forked from 6.0) Make React Redux great again!
Stars: ✭ 62 (+129.63%)
Mutual labels:  fast
ormsgpack
Msgpack serialization/deserialization library for Python, written in Rust using PyO3 and rust-msgpack. Reboot of orjson. msgpack.org[Python]
Stars: ✭ 88 (+225.93%)
Mutual labels:  fast
fastweb
fastweb is a web-server integration solution. It based on tornado, celery, thrift.
Stars: ✭ 17 (-37.04%)
Mutual labels:  fast
qpage
👨‍💻 Free Project For Creating Academic Homepage Without Any Code In 3min
Stars: ✭ 87 (+222.22%)
Mutual labels:  fast
STCRouter
基于标准URL的iOS路由系统,可实现业务模块组件化,控制器之间零耦合,可实现黑白名单控制,可进行native降级到hybrid。
Stars: ✭ 19 (-29.63%)
Mutual labels:  route

Route - A fast route implemented by php

StyleCI Build Status Scrutinizer Code Quality

zqhong/route is inspred by nikic/FastRoute. But it is faster than FastRoute.


Install

$ composer require -vvv "zqhong/route:dev-master"

Example

<?php

use zqhong\route\Helpers\Arr;
use zqhong\route\RouteCollector;
use zqhong\route\RouteDispatcher;

require dirname(__DIR__) . "/vendor/autoload.php";

function getUser($uid)
{
    echo "Your uid: " . $uid;
}

/** @var RouteDispatcher $routeDispatcher */
$routeDispatcher = dispatcher(function (RouteCollector $r) {
    $r->addRoute('GET', '/user/{id:\d+}', 'getUser');
});

$httpMethod = 'GET';
$uri = '/user/1';
$routeInfo = $routeDispatcher->dispatch($httpMethod, $uri);

if (Arr::getValue($routeInfo, 'isFound')) {
    $handler = Arr::getValue($routeInfo, 'handler');
    $params = Arr::getValue($routeInfo, 'params');
    call_user_func_array($handler, $params);
} else {
    echo '404 NOT FOUND';
}

Using CURL send request:

// return 404 NOT FOUND
$ curl http://example.com/?r=ops

// return Your uid: 1
$ curl http://example.com/?=/user/1

Benchmark

Environment

  • OS:Ubuntu 16.04 LTS(Vultr 4Cores 8G memory)
  • PHP:7.0.4
  • Apache:2.4.18

Result

nikic_route(v1.2)
Requests per second:    3527.98 [#/sec] (mean)

symfony route(v3.2)
Requests per second:    5193.17 [#/sec] (mean)

zqhong route(dev-master)
Requests per second:    5923.56 [#/sec] (mean)

Benchmark test code and result in benchmark folder.


Document

How it works

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].