Skip to content

Commit

Permalink
Merge branch 'feature/lumen_demo' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Knap committed Sep 29, 2016
2 parents 13d1722 + 95ca4a3 commit 9cea6cf
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 4 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ If you wish to know more about [Profiler], please visit [Profiler's README.md].

Run `composer require netpromotion/profiler` in your project directory.

![Adapter for Tracy](https://raw.githubusercontent.com/netpromotion/profiler/master/demo/tracy.png)


### [Nette]

Expand All @@ -72,13 +74,26 @@ extensions:

If you wish to profile before the container is ready, call `Profiler::enable` manually.

![Adapter for Tracy](https://raw.githubusercontent.com/netpromotion/profiler/master/demo/tracy.png)

There is a live demo available - run `make demo` and [click here](http://127.0.0.1:8080/nette/).


### [Lumen], pure PHP and everything else

Add panel `Netpromotion\Profiler\Adapter\TracyBarAdapter` to your bar via `Bar::addPanel` method manually or use [netpromotion/tracy-wrapper].

```php
tracy_wrap(function() {
/* your code goes here */
}, [new TracyBarAdapter()]);
```

There is a live demo available - run `make demo` and [click here](http://127.0.0.1:8080/lumen/).



[Profiler]:https://packagist.org/packages/petrknap/php-profiler
[Tracy]:https://tracy.nette.org/
[Profiler's README.md]:https://github.com/petrknap/php-profiler/blob/master/README.md
[Nette]:https://nette.org/
[Lumen]:https://lumen.laravel.com/
[netpromotion/tracy-wrapper]:https://github.com/netpromotion/tracy-wrapper
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"config": {
"platform": {
"php": "5.4.45",
"ext-dom": true
"ext-dom": true,
"ext-mbstring": true
}
},
"require": {
Expand All @@ -30,7 +31,9 @@
"nette/bootstrap": "^2.3",
"nette/application": "^2.3",
"latte/latte": "^2.3",
"phpunit/phpunit": "^4.8"
"phpunit/phpunit": "^4.8",
"netpromotion/tracy-wrapper": "1.0.0-a1 as 1.0.0",
"laravel/lumen-framework": "^5.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions demo/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Options +Indexes
34 changes: 34 additions & 0 deletions demo/lumen/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Laravel\Lumen\Application;
use Netpromotion\Profiler\Adapter\TracyBarAdapter;
use Netpromotion\Profiler\Profiler;
use Tracy\Debugger;

require_once __DIR__ . "/../require_me.php";

if (DEBUG_MODE === true) {
Debugger::enable(true, __DIR__ . "/storage/logs");
Profiler::enable();
}

tracy_wrap(function() {
Profiler::start(/* keep default label for better preview */);

$app = new Application(__DIR__);

$app->get("/lumen/", function() use ($app) {
Profiler::start("GET /lumen/");

doSomething();
$return = $app->welcome();

Profiler::finish("GET /lumen/");

return $return;
});

$app->run();

Profiler::finish(/* keep default label for better preview */);
}, [new TracyBarAdapter()]);
2 changes: 2 additions & 0 deletions demo/lumen/storage/logs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
1 change: 1 addition & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ demo:
sudo make demo-clean demo-build demo-run

demo-build:
chmod 0777 demo/lumen/storage/logs -R
chmod 0777 demo/nette/log -R
chmod 0777 demo/nette/temp -R
docker build -t profiler-demo .
Expand Down

0 comments on commit 9cea6cf

Please sign in to comment.