Skip to content

Commit

Permalink
Merge pull request #11 from qrazi/master
Browse files Browse the repository at this point in the history
Make the bridge compatible with Lumen
  • Loading branch information
lisachenko authored Dec 15, 2017
2 parents f3c83d3 + 7ad9065 commit 666e689
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ GoAopBridge can be easily installed with composer. Just ask a composer to downlo
$ composer require goaop/goaop-laravel-bridge
```

### Setup Laravel
Add the `Go\Laravel\GoAopBridge\GoAopServiceProvider` to your config/app.php `providers` array:
```php
// config/app.php
Expand All @@ -41,15 +42,36 @@ Add the `Go\Laravel\GoAopBridge\GoAopServiceProvider` to your config/app.php `pr
```
Make sure that this service provider is the **first item** in this list. This is required for the AOP engine to work correctly.

### Setup Lumen
Register the `Go\Laravel\GoAopBridge\GoAopServiceProvider` to the app in your bootstrap/app.php:
```php
// bootstrap/app.php
<?php
// After `$app` is created

$app->register(\Go\Laravel\GoAopBridge\GoAopServiceProvider::class);
```
Make sure that this service provider is the **first** call to `$app->register()`. This is required for the AOP engine to work correctly.

Configuration
-------------

The default configuration in the `config/go_aop.php` file. Copy this file to your own config directory to modify the values. You can also publish the config using this command:
The default configuration in the `config/go_aop.php` file. If you want to change any of the default values you have to copy this file to your own config directory to modify the values.

If you use Laravel, you **can** also publish the config using this command:
```bash
./artisan vendor:publish --provider="Go\Laravel\GoAopBridge\GoAopServiceProvider"
```

If you use Lumen, you **have** to manually load the config file, example:
```php
// bootstrap/app.php
<?php
// After `$app` is created

$app->configure('go_aop');
```

Configuration can be used for additional tuning of AOP kernel and source code whitelistsing/blacklisting.
```php
// config/go_aop.php
Expand Down Expand Up @@ -115,7 +137,7 @@ return [
| leave it empty if you want AOP to be applied to all files in the appDir
*/
'includePaths' => [
app_path()
app('path')
],

/*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["bridge", "laravel", "aop", "php", "aspect"],
"require": {
"goaop/framework": "^1.0|^2.0",
"laravel/framework": "^5.0"
"illuminate/support": "^5.0"
},
"license": "MIT",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion config/go_aop.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
| leave it empty if you want AOP to be applied to all files in the appDir
*/
'includePaths' => [
app_path()
app('path')
],

/*
Expand Down
3 changes: 1 addition & 2 deletions src/GoAopServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Go\Core\AspectContainer;
use Go\Core\AspectKernel;
use Go\Laravel\GoAopBridge\Kernel\AspectLaravelKernel;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;

/**
Expand Down Expand Up @@ -55,7 +54,7 @@ public function register()
return $aspectKernel;
});

$this->app->singleton(AspectContainer::class, function (Application $app) {
$this->app->singleton(AspectContainer::class, function ($app) {
/** @var AspectKernel $kernel */
$kernel = $app->make(AspectKernel::class);

Expand Down

0 comments on commit 666e689

Please sign in to comment.