Skip to content

Commit 9495f6c

Browse files
committed
Create REST API benchmark
0 parents  commit 9495f6c

File tree

10 files changed

+15200
-0
lines changed

10 files changed

+15200
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
vendor/
3+
composer.lock

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<p align="center">
2+
<img src="http://www.phpbenchmarks.com/images/logo_github.png">
3+
<br>
4+
<a href="http://www.phpbenchmarks.com" target="_blank">www.phpbenchmarks.com</a>
5+
</p>
6+
7+
## What is www.phpbenchmarks.com ?
8+
9+
You will find lot of benchmarks for PHP frameworks and template engines.
10+
11+
You can compare results between Apache Bench and Siege, and PHP 5.6 to 7.2.
12+
13+
## What is this repository ?
14+
15+
It's benchmark common code for PHP benchmarks.
16+
17+
Switch branch to select your PHP major version and benchmark you want to see.
18+
19+
See all PHP benchmarked versions on [phpbenchmarks/php](https://github.com/phpbenchmarks/php).
20+
21+
You can find how we benchmark on [phpbenchmarks.com](http://www.phpbenchmarks.com/en/benchmark-protocol.html).
22+
23+
## Benchmarks
24+
25+
You can find all PHP benchmarks results on [phpbenchmarks.com](http://www.phpbenchmarks.com/en/benchmark/php.html).
26+
27+
Scores are too low ? Do not hesitate to create a pull request, and ask a new benchmark !

Translation/TranslationService.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Php73Benchmark\Translation;
6+
7+
class TranslationService
8+
{
9+
protected static $translations = false;
10+
11+
public static function loadTranslations(): void
12+
{
13+
$locales = ['fr_FR', 'en_GB', 'aa_BB'];
14+
$locale = $locales[rand(0, 2)];
15+
16+
if (file_exists(__DIR__ . '/phpbenchmarks.' . $locale . '.php')) {
17+
static::$translations = require(__DIR__ . '/phpbenchmarks.' . $locale . '.php');
18+
} else {
19+
static::$translations = require(__DIR__ . '/phpbenchmarks.en.php');
20+
}
21+
}
22+
23+
public static function getTranslation(string $key): string
24+
{
25+
return static::$translations[$key] ?? $key;
26+
}
27+
}

0 commit comments

Comments
 (0)