Skip to content

Commit eba8c71

Browse files
committed
Merge pull request #8 from cspray/fix-request-global
Fix request global
2 parents 0b8610e + 3537584 commit eba8c71

30 files changed

+452
-421
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## v0.4.0 - 2016-02-13
4+
5+
- Updates FastRoute to 0.7.0
6+
- Updates Labrador to 1.1.0
7+
- Refactors core Labrador events to not use HttpEvents and to use those provided by labrador proper. A result of this
8+
is the removal of the HttpEventFactory
9+
- Refactors HandlerResolver to accept a Request as the first argument for more flexible and powerful handler resolving.
10+
- Refactors the InjectorExecutorResolver to not require the Request be shared in the container. A side effect of this is
11+
that all controller parameters that want a Request MUST be named either `$request` or `$req`.
12+
- Refactors how we invoke a controller object's beforeController and afterController methods. Several improvements were
13+
made, please see the specific commit message for more information.
14+
- Ensures that custom FastRoute parameters are appropriately URL decoded.
15+
16+
## v0.2.0 - 2016-01-08
17+
18+
- Removes Telluris dependency
19+
- Updates Labrador to 0.3.1 and Symfony HTTP Foundation to 3.0.1
20+
- Moves autoloading from PSR-0 to PSR-4
21+
322
## v0.1.0 - 2015-08-23
423

524
- Initial launch

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Charles Sprayberry
3+
Copyright (c) 2016 Charles Sprayberry
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ $injector = bootstrap();
3737
$engine = $injector->make(Engine::class);
3838

3939
$engine->get('/', new Response('hello world'));
40+
$engine->get('/closure', function() {
41+
return new Response('Because of course you can do this');
42+
});
43+
44+
// You'd really want to put this in its own file
45+
class MyController {
46+
47+
public function someMethodThatYouName() {
48+
return new Response('And, yea, from the controller object too');
49+
}
50+
51+
}
52+
53+
$engine->get('/controller-object', MyController::class . '#someMethodThatYouName');
4054

4155
$engine->run();
4256
```

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"name": "cspray/labrador-http",
33
"require": {
44
"php": "~7.0",
5-
"cspray/labrador": "~0.3",
6-
"nikic/fast-route": "0.6.0",
5+
"cspray/labrador": "~1.0",
6+
"nikic/fast-route": "0.7.0",
77
"symfony/http-foundation": "~3.0.0"
88
},
99
"require-dev": {
10-
"phpunit/phpunit": "5.1.3"
10+
"phpunit/phpunit": "5.2.5"
1111
},
1212
"autoload": {
1313
"psr-4": {

composer.lock

Lines changed: 92 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

init.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
$engine = $injector->make(Engine::class);
1717

1818
$engine->get('/', WelcomeController::class . '#index');
19+
$engine->get('/echo/{param}', WelcomeController::class . '#echo');
20+
$engine->get('/info', function() {
21+
ob_start();
22+
phpinfo();
23+
$response = ob_get_clean();
1924

20-
$controllerPlugin = new ControllerServicePlugin([WelcomeController::class]);
21-
$engine->registerPlugin($controllerPlugin);
25+
return new \Symfony\Component\HttpFoundation\Response($response);
26+
});
2227

2328
$engine->run();
24-
25-
26-

0 commit comments

Comments
 (0)