Skip to content

Commit b69b0da

Browse files
steevanbphpbenchmarks
authored andcommitted
Documentation for REST API benchmark kit
1 parent 8107eb0 commit b69b0da

3 files changed

Lines changed: 39 additions & 4 deletions

File tree

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Benchmark kit is a tool to add a framework or a template engine benchmark on [ph
88

99
Documentation
1010
-
11-
11+
* [Changelog](changelog.md)
1212
* [Understand repositories and branches](documentation/repositoriesAndBranches.md)
1313

1414
Requirements
@@ -26,7 +26,7 @@ Installation
2626
# you can install it where you want, ~/benchmarkKit used for the example
2727
mkdir ~/benchmarkKit
2828
cd ~/benchmarkKit
29-
echo '{"require": {"phpbenchmarks/benchmark-kit": "^2.0"}}' > composer.json
29+
echo '{"require": {"phpbenchmarks/benchmark-kit": "^3.0"}}' > composer.json
3030

3131
# you can use your local composer installation, of the official Docker container
3232
docker run --rm -v $(pwd):/app composer/composer update --no-dev
@@ -101,7 +101,8 @@ You can call `configure:all` to create all of them, or use the one your need.
101101

102102
Note the `phpbench composer:update` command. We need a `composer.lock` per PHP version,
103103
because some dependencies are installed in different versions depending on the version of PHP.
104-
Use `phpbench composer:update` to switch between PHP version, and create `composer.lock.phpX.Y`.
104+
105+
Use `phpbench composer:update` to switch between PHP version, and create `.phpbenchmarks/composer.lock.phpX.Y`.
105106

106107
```bash
107108
phpbench composer:update
@@ -116,7 +117,7 @@ Choose the component type and benchmark type you want to code:
116117

117118
* Framework
118119
* [Hello world benchmark](documentation/framework/helloWorld.md)
119-
* REST API benchmark (coming soon)
120+
* [REST API benchmark](documentation/framework/restApi.md)
120121
* Template engine
121122
* Hello world benchmark (coming soon)
122123

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### [3.0.0](../../compare/2.0.0...3.0.0) - 2018-04-28
2+
3+
- Move `composer.lock.php*` to .phpbenchmarks directory.
4+
- Add REST API documentation and kit.
5+
6+
### [2.0.0](../../compare/1.0.6...2.0.0) - 2018-01-20
7+
8+
- Bash scripts are transformed into PHP commands.

documentation/framework/restApi.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
REST API benchmark
2+
-
3+
4+
This benchmark respresent a REST API application.
5+
6+
It contains 500 routes, 15,000 translations and return 100 PHP objects serialized in JSON.
7+
8+
An event is triggered to randomly define language and benchmark event dispatcher.
9+
10+
No database access is made, to not influence the results.
11+
12+
Features
13+
-
14+
15+
Don't forget this features as to be coded in [common repository](../repositoriesAndBranches.md).
16+
17+
* A route with the url `benchmark/rest`. Is should be the first defined route. [Example](https://github.com/phpbenchmarks/symfony-common/blob/symfony_4_rest-api/Resources/config/routing.yml).
18+
* 500 other routes with the url `/benchmark/test-route-x`, defined after the first one. [Example](https://github.com/phpbenchmarks/symfony-common/blob/symfony_4_rest-api/Resources/config/routing.yml).
19+
* A controller called by the url `benchmark/rest`. [Example](https://github.com/phpbenchmarks/symfony-common/blob/symfony_4_rest-api/Controller/RestApiController.php).
20+
* Trigger an event to randomly define language. [Example](https://github.com/phpbenchmarks/symfony-common/blob/symfony_4_rest-api/Controller/RestApiController.php).
21+
* This event should randomly define language between `fr_FR`, `en_GB` and `en` (to use fallback system). [Example](https://github.com/phpbenchmarks/symfony-common/blob/symfony_4_rest-api/EventListener/DefineLocaleEventListener.php).
22+
* Serialize the return of `PhpBenchmarksRestData\Service\Service::getUsers()` into json. [Example](https://github.com/phpbenchmarks/symfony-common/blob/symfony_4_rest-api/Normalizer/UserNormalizer.php).
23+
* Return this json in response body with `Content-Type: application/json` header. [Example](https://github.com/phpbenchmarks/symfony-common/blob/symfony_4_rest-api/Controller/RestApiController.php).
24+
* 5,000 translations by language (`fr_FR`, `en_GB` and `en` so 15,000 translations in total). [Example](https://github.com/phpbenchmarks/laravel-common/blob/laravel_5_rest-api/Resources/lang/en_GB/phpbenchmarks.php).
25+
26+
[Back to documentation index](../../README.md)

0 commit comments

Comments
 (0)