File tree Expand file tree Collapse file tree 12 files changed +168
-0
lines changed
Expand file tree Collapse file tree 12 files changed +168
-0
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,7 @@ Note: This project is based on
234234* [ Laravel] ( https://github.com/laravel/laravel )
235235* [ Leaf] ( https://github.com/leafsphp/leaf )
236236* [ Lumen] ( https://github.com/laravel/lumen )
237+ * [ Nette] ( https://github.com/nette/web-project )
237238* [ PhRoute] ( https://github.com/mrjgreen/phroute )
238239* [ Silex] ( https://github.com/silexphp/Silex )
239240* [ Slim] ( https://github.com/slimphp/Slim )
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ laravel-10.3
2525laravel-11.0
2626leaf-3.11
2727lumen-10.0
28+ nette-4.0
2829phroute-2.2
2930pure-php
3031silex-2.3
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ rm -rf ! (" _benchmark" )
3+ find -path ' ./.*' -delete
4+ rm -rf _benchmark/temp
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ # clear cache
3+ echo -e " done"
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ url=" $base /$fw /www/index.php/hello/index"
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace app ;
6+
7+ use Nette ;
8+ use Nette \Bootstrap \Configurator ;
9+
10+
11+ class Bootstrap
12+ {
13+ private Configurator $ configurator ;
14+ private string $ rootDir ;
15+
16+
17+ public function __construct ()
18+ {
19+ $ this ->rootDir = dirname (__DIR__ );
20+ $ this ->configurator = new Configurator ;
21+ $ this ->configurator ->setTempDirectory ($ this ->rootDir . '/temp ' );
22+ }
23+
24+
25+ public function bootWebApplication (): Nette \DI \Container
26+ {
27+ $ this ->initializeEnvironment ();
28+ $ this ->setupContainer ();
29+ return $ this ->configurator ->createContainer ();
30+ }
31+
32+
33+ public function initializeEnvironment (): void
34+ {
35+ //$this->configurator->setDebugMode('secret@23.75.345.200'); // enable for your remote IP
36+ $ this ->configurator ->enableTracy ($ this ->rootDir . '/log ' );
37+
38+ $ this ->configurator ->createRobotLoader ()
39+ ->addDirectory (__DIR__ )
40+ ->register ();
41+ }
42+
43+
44+ private function setupContainer (): void
45+ {
46+ $ configDir = $ this ->rootDir . '/config ' ;
47+ $ this ->configurator ->addConfig ($ configDir . '/common.neon ' );
48+ $ this ->configurator ->addConfig ($ configDir . '/services.neon ' );
49+ }
50+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace app \Core ;
6+
7+ use Nette ;
8+ use Nette \Application \Routers \RouteList ;
9+
10+ /*
11+ PHP-Frameworks-Bench
12+ this is a simple hello world controller to make benchmark
13+ */
14+ final class RouterFactory
15+ {
16+ use Nette \StaticClass;
17+
18+ public static function createRouter (): RouteList
19+ {
20+ $ router = new RouteList ;
21+ $ router
22+ ->withPath ('index.php ' )
23+ ->addRoute ('hello/index ' , function () {
24+ echo 'Hello World! ' ;
25+ });
26+
27+ return $ router ;
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ # see https://doc.nette.org/en/configuring
2+
3+ parameters :
4+
5+
6+ application :
7+ mapping : App\Presentation\*\**Presenter
8+
9+
10+ database :
11+ dsn : ' sqlite::memory:'
12+ user :
13+ password :
14+
15+
16+ latte :
17+ strictTypes : yes
18+ strictParsing : yes
19+ extensions :
20+ - App\Presentation\Accessory\LatteExtension
21+
22+
23+ assets :
24+ mapping :
25+ default :
26+ path : assets
27+ # type: vite # Uncomment to activate Vite for asset building
28+
29+
30+ di :
31+ export :
32+ parameters : no
33+ tags : no
Original file line number Diff line number Diff line change 1+ services :
2+ - App\Core\RouterFactory::createRouter
3+
4+
5+ search :
6+ - in : %appDir%
7+ classes :
8+ - *Facade
9+ - *Factory
10+ - *Repository
11+ - *Service
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ require __DIR__ . '/../vendor/autoload.php ' ;
6+
7+ $ bootstrap = new app \Bootstrap ;
8+ $ container = $ bootstrap ->bootWebApplication ();
9+ $ application = $ container ->getByType (Nette \Application \Application::class);
10+ $ application ->run ();
11+
12+ /* *** PHP-Frameworks-Bench *** */
13+ require $ _SERVER ['DOCUMENT_ROOT ' ].'/PHP-Frameworks-Bench/libs/output_data.php ' ;
You can’t perform that action at this time.
0 commit comments