Skip to content

Commit a6c71b1

Browse files
authored
Merge pull request #5 from marcmascort/feature/lumen-support
Add Lumen support
2 parents 8b7e0e6 + 26d0883 commit a6c71b1

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ composer.lock
33
docs
44
vendor
55
coverage
6-
.idea
6+
.idea
7+
nbproject

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ return [
8080
];
8181
```
8282

83+
If you use **Lumen**, you need to copy the config file manually and register the Lumen Service Provider in `bootstrap/app.php` file
84+
85+
```php
86+
$this->app->register(\BeyondCode\QueryDetector\LumenQueryDetectorServiceProvider::class);
87+
```
88+
8389
### Testing
8490

8591
``` bash
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
namespace BeyondCode\QueryDetector;
3+
4+
use Illuminate\Support\ServiceProvider;
5+
6+
class LumenQueryDetectorServiceProvider extends ServiceProvider
7+
{
8+
9+
public function register()
10+
{
11+
$this->app->configure('querydetector');
12+
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'querydetector');
13+
14+
$this->app->middleware([
15+
QueryDetectorMiddleware::class
16+
]);
17+
18+
$this->app->singleton(QueryDetector::class);
19+
$this->app->alias(QueryDetector::class, 'querydetector');
20+
}
21+
}

0 commit comments

Comments
 (0)