Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upstream fixes, simplified controller resolving #5

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: php

php:
- 5.3.3
- 5.3
- 5.4
- 5.5
- 5.6
Expand Down
45 changes: 22 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,41 @@ React/Http.
The recommended way to install react/espresso is [through
composer](http://getcomposer.org).

```JSON
{
"require": {
"minimum-stability": "dev",
"react/espresso": "0.2.*"
}
}
```
$ composer require react/espresso
```

## Example

$app = new React\Espresso\Application();
> all your Controllers stay the same, the converting between symfony request/response and react request/response is completely shallow

```php
<?php
// react.php

$app->get('/', function ($request, $response) {
$response->writeHead(200, array('Content-Type' => 'text/plain'));
$response->end("Hello World\n");
});
$app = new React\Espresso\Application();

$app->get('/favicon.ico', function ($request, $response) {
$response->writeHead(204);
$response->end();
});
$app->get('/hello/{name}', function ($name) use ($app) {
return 'Hello '.$app->escape($name);
});

$stack = new React\Espresso\Stack($app);
$stack->listen(1337);
```

$app->get('/humans.txt', function ($request, $response) {
$response->writeHead(200, array('Content-Type' => 'text/plain'));
$response->end("I believe you are a humanoid robot.\n");
});
```
$ php react.php
```

$stack = new React\Espresso\Stack($app);
$stack->listen(1337);
> now visit [http://localhost:1337/hello/react](http://localhost:1337/hello/react)

## Tests

To run the test suite, you need PHPUnit.

$ phpunit
```
$ phpunit
```

## License

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"keywords": ["microframework"],
"license": "MIT",
"require": {
"php": ">=5.3.3",
"react/http": "0.2.*",
"silex/silex": "1.0.*@dev"
"php": ">=5.4",
"react/http": "~0.4",
"silex/silex": "~1.0"
},
"autoload": {
"psr-0": { "React\\Espresso": "src" }
Expand Down
Loading