Skip to content

Commit 69caad1

Browse files
committed
Add Hello world and Rest benchmarks
1 parent 17de45a commit 69caad1

File tree

11 files changed

+15203
-1
lines changed

11 files changed

+15203
-1
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+

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1-
# php-7-2
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, ORM and libs here.
10+
11+
You can compare results between Apache Bench and Siege, PHP 5.6 to 7.2 and versions of your favorites PHP code.
12+
13+
## What is this repository ?
14+
15+
It's benchmark source code for PHP 7.2.
16+
17+
You can find how we benchmark it [here](http://www.phpbenchmarks.com/en/benchmark-protocol).
18+
19+
## PHP 7.2
20+
21+
Benchmark | Tool | Score
22+
--------- | ---- | -----
23+
[Hello World](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.2.html#benchmark-hello-world) | Apache Bench | In progress
24+
[News](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.2.html#benchmark-news) | Apache Bench | In progress
25+
[Rest API](http://www.phpbenchmarks.com/en/benchmark/apache-bench/php-7.2.html#benchmark-rest) | Apache Bench | In progress
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 Php72Benchmark\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)