Skip to content

Commit

Permalink
Add built-in attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ngmy committed Sep 9, 2024
1 parent f1adb2d commit 14b8330
Show file tree
Hide file tree
Showing 111 changed files with 30,384 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
/.php-cs-fixer.php
/.php-cs-fixer.cache

# phpDocumentor
/.phpdoc/

# NPM
/node_modules/
/package-lock.json
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ For example, let's register the `Transactional` attribute and the `Transactional
```php
use App\Attributes\Transactional;
use App\Interceptors\TransactionalInterceptor;
use Ngmy\LaravelAop\Collections\InterceptMap;

'intercept' => [
'intercept' => InterceptMap::default()->merge([
Transactional::class => [
TransactionalInterceptor::class,
],
],
])->toArray(),
```

Then, you should annotate the methods that you want to intercept with the attribute.
Expand Down Expand Up @@ -182,6 +183,12 @@ You may easily compile the AOP classes automatically after the `dump-autoload` C
}
```

## Built-in attributes

- [Cache](docs/namespaces/ngmy-laravelaop-aspects-cache-attributes.html)
- [Transaction](docs/namespaces/ngmy-laravelaop-aspects-transaction-attributes.html)
- [Retry](docs/namespaces/ngmy-laravelaop-aspects-retry-attributes.html)

## Changelog

Please see the [changelog](CHANGELOG.md).
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
},
"composer-attribute-collector": {
"include": [
"tests/Feature/Aspects/Cache/stubs",
"tests/Feature/Aspects/Retry/stubs",
"tests/Feature/Aspects/Transaction/stubs",
"tests/Feature/stubs"
]
},
Expand Down
21 changes: 19 additions & 2 deletions config/aop.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

declare(strict_types=1);

use Ngmy\LaravelAop\Collections\InterceptMap;

return [
/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -31,8 +33,8 @@
|
*/

'intercept' => [
],
'intercept' => InterceptMap::default()->merge([
])->toArray(),

/*
|--------------------------------------------------------------------------
Expand All @@ -49,4 +51,19 @@
config_path('aop.php'),
],
],

/*
|--------------------------------------------------------------------------
| Transaction Aspect Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your transaction aspect settings.
|
*/

'transaction' => [
'rollback_for' => [
Throwable::class,
],
],
];
Loading

0 comments on commit 14b8330

Please sign in to comment.