Skip to content

Commit

Permalink
Merge b4b83c1 into 7872c61
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed May 30, 2018
2 parents 7872c61 + b4b83c1 commit 4c78ed7
Show file tree
Hide file tree
Showing 38 changed files with 2,094 additions and 1,135 deletions.
8 changes: 2 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
}
],
"require": {
"psr/cache": "^1.0",
"bavix/slice": "^1.0"
"psr/cache": "^1.0"
},
"require-dev": {
"tedivm/stash": "^0.14",
Expand All @@ -33,10 +32,7 @@
"autoload": {
"psr-4": {
"Bavix\\": "src/"
},
"files": [
"libs/helper.php"
]
}
},
"autoload-dev": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions demo/build.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

include_once \dirname(__DIR__) . '/vendor/autoload.php';

var_dump(\Bavix\Router\Server::url('/hello')); // https://cli/hello
var_dump(\Bavix\Router\Server::url('/hello', 'router.local'));
var_dump(\Bavix\Router\Server::url('/hello', 'router.local', 'cli')); // https://cli/hello
79 changes: 0 additions & 79 deletions demo/global.json

This file was deleted.

4 changes: 2 additions & 2 deletions demo/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'http' => [

'type' => 'http',
'type' => 'prefix',

'protocol' => 'http', // optional null
'host' => '(.+\.)?example.com', // optional null
Expand Down Expand Up @@ -82,7 +82,7 @@
'default' => [
'type' => 'pattern',
'path' => [
'/<any:\w+>',
'/<any>',
[
'any' => '.*'
]
Expand Down
72 changes: 0 additions & 72 deletions demo/global.xml

This file was deleted.

62 changes: 0 additions & 62 deletions demo/global.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions demo/groups.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

include_once \dirname(__DIR__) . '/vendor/autoload.php';

$group = new \Bavix\Router\Group('/api', function (\Bavix\Router\GroupResolution $route) {
$route->get('/hello');
$route->resource('/users');
});

var_dump((new \Bavix\Router\Loader($group->toArray()))->simplify());
9 changes: 5 additions & 4 deletions demo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
$route = $router->getCurrentRoute();

var_dump(
\Bavix\Router\route($route),
$route->getAttributes(),
$route->getDefaults(),
$route->getHttp(),
$route->getProtocol(),
$route->getHost(),
$route->getPath(),
$route->getRegex(),
$route->getRegexPath()
$route->getPattern(),
$route->getPathPattern(),
$route->getName()
);
9 changes: 9 additions & 0 deletions demo/loader-v2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

include_once dirname(__DIR__) . '/vendor/autoload.php';

$loader = new \Bavix\Router\Loader(require __DIR__ . '/global.php');

foreach ($loader->simplify() as $key => $route) {
var_dump([$key => $route]);
}
4 changes: 2 additions & 2 deletions demo/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
$driver = new \Stash\Driver\FileSystem();
$pool = new \Stash\Pool($driver);

//$loader = new \Bavix\SDK\FileLoader\PHPLoader(__DIR__ . '/global.php');
$loader = new \Bavix\SDK\FileLoader\PHPLoader(__DIR__ . '/global.php');
//$loader = new \Bavix\SDK\FileLoader\JSONLoader(__DIR__ . '/global.json');
//$loader = new \Bavix\SDK\FileLoader\YamlLoader(__DIR__ . '/global.yaml');
$loader = new \Bavix\SDK\FileLoader\XmlLoader(__DIR__ . '/global.xml');
//$loader = new \Bavix\SDK\FileLoader\XmlLoader(__DIR__ . '/global.xml');
$slice = $loader->asSlice();

$router = new \Bavix\Router\Router($slice, $pool);
Expand Down
4 changes: 4 additions & 0 deletions demo/pattern.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

include_once \dirname(__DIR__) . '/vendor/autoload.php';

0 comments on commit 4c78ed7

Please sign in to comment.