Skip to content

Commit

Permalink
init:初始化项目
Browse files Browse the repository at this point in the history
  • Loading branch information
zqhong committed Mar 6, 2017
0 parents commit 3eb1b49
Show file tree
Hide file tree
Showing 21 changed files with 1,942 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
.idea
11 changes: 11 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
checks:
php:
code_rating: true
duplication: true

filter:
paths:
- src/*
excluded_paths:
- vendor/*
- tests/*
5 changes: 5 additions & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
preset: psr2

finder:
name:
- "*.php"
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: php

php:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- hhvm

matrix:
allow_failures:
- php: '7.1'
- php: 'hhvm'

sudo: false

before_script:
- composer self-update
- composer install

cache:
directories:
- ./vendor

script: vendor/bin/phpunit -c phpunit.xml
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License

Copyright (c) 2012 zqhong - <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Route - 一个高性能的 PHP 请求路由
思路参考[nikic/FastRoute](https://github.com/nikic/FastRoute),实现原理:[Fast request routing using regular expressions](http://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html)

# Example
```
<?php
use Zqhong\Route\RouteCollector;
require "vendor/autoload.php";
$routeDispatcher = dispatcher(function (RouteCollector $r) {
$r->addRoute('GET', '/user/{id:\d+}', 'getUser');
});
$httpMethod = 'GET';
$uri = '/user/1';
$r = $routeDispatcher->dispatch($httpMethod, $uri);
print_r($r);
```
27 changes: 27 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "Zqhong/Route",
"description": "A route inspired by nikic/fast-route",
"minimum-stability": "dev",
"license": "MIT",
"authors": [
{
"name": "zqhong",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"Zqhong\\Route\\": "src/",
"Zqhong\\Route\\Test\\": "test/"
},
"files": [
"src/functions.php"
]
},
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
}
}
Loading

0 comments on commit 3eb1b49

Please sign in to comment.