-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* develop: mention the async server is optional add async server to changelog fix link add documentation ifx blackbox set size enable functional test in the CI splits tests from coverage force the use of async-http-server 1 use innmind/async-http-server 1 Revert "fix minimum version of the os" disable functional test in the CI fix minimum version of the os ignore async http from code coverage add functional test to make sure the async http server works use psalm 5 add async http server
- Loading branch information
Showing
12 changed files
with
503 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ignore: | ||
- src/Application/Async/Http.php | ||
- src/Main/Async/Http.php | ||
- .php-cs-fixer.dist.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Async HTTP Server | ||
|
||
The framework comes with an HTTP server entirely built in PHP allowing you to serve your app without extra dependencies in ther earlist stages of your project. | ||
|
||
**Note**: This feature is optional, to use it you must before run `composer require innmind/async-http-server`. | ||
|
||
To use it is similar to the standard [http](../http.md) handler, the first difference is the namespace of the main entrypoint: | ||
|
||
```php | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
require 'path/to/composer/autoload.php'; | ||
|
||
use Innmind\Framework\{ | ||
Main\Async\Http, | ||
Application, | ||
}; | ||
|
||
new class extends Http { | ||
protected function configure(Application $app): Application | ||
{ | ||
return $app; | ||
} | ||
}; | ||
``` | ||
|
||
Note the namespace is `Main\Async\Http` instead of `Main\Http`. The other difference is instead of pointing your HTTP Server to the folder containing the php file you run the server via `php index.php`. | ||
|
||
All the configuration of the `Application` object is identical to the other contexts. | ||
|
||
**Note**: The server currently does have limitations, streamed requests (via `Transfer-Encoding`) are not supported and multipart requests are not parsed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
require __DIR__.'/../vendor/autoload.php'; | ||
|
||
use Innmind\Framework\{ | ||
Application, | ||
Main\Async\Http, | ||
Http\Routes, | ||
}; | ||
use Innmind\Router\Route; | ||
|
||
new class extends Http | ||
{ | ||
protected function configure(Application $app): Application | ||
{ | ||
return $app->appendRoutes(static fn($routes) => $routes->add( | ||
Route::literal('GET /hello'), | ||
)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.