PHPackages                             formal-bears/aop - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. formal-bears/aop

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

formal-bears/aop
================

AOP utility for BEAR.Sunday

0.1.0(6y ago)07BSD-2-ClausePHPPHP &gt;=7.2.0CI failing

Since Dec 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/kumamidori/FormalBears.Aop)[ Packagist](https://packagist.org/packages/formal-bears/aop)[ RSS](/packages/formal-bears-aop/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

FormalBears.Aop
===============

[](#formalbearsaop)

[![Build Status](https://camo.githubusercontent.com/3eb6ae55aa9c8ec66e47c4c10ef736246d211f501e75cc63e0747a19fa2985c9/68747470733a2f2f7472617669732d63692e6f72672f6b756d616d69646f72692f466f726d616c42656172732e416f702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kumamidori/FormalBears.Aop)

[formal-bears/aop](https://packagist.org/packages/formal-bears/aop)

AOP utility for BEAR.Sunday

Installation
------------

[](#installation)

```
composer require formal-bears/aop:^0.1

```

Feature
-------

[](#feature)

- Equals-to matcher
- HTTP Method matcher

Usage
-----

[](#usage)

### リソースのHTTPメソッドをインターセプトしたい場合の実装例

[](#リソースのhttpメソッドをインターセプトしたい場合の実装例)

```
// モジュールでの束縛
$this->bindInterceptor(
    $this->matcher->subclassesOf(ResourceObject::class),
    new IsHttpMethodMatcher(),  // HTTPメソッドマッチャー
    [FooInterceptor::class] // 束縛したいインターセプター
);
```

リソースインターセプターの用途としては、自分のドメインに合ったフレームワーク（開発基盤）を作りたいときを想定しています。 BEARは標準セットで使うこともできますが、拡張に対して開かれているので、フレームワークを作ることもできます。

Requires
--------

[](#requires)

`>= PHP 7.2`

実装の紹介（スニペット）
------------

[](#実装の紹介スニペット)

```
// リソースのメソッドのためのカスタムマッチャー
class IsHttpMethodMatcher extends EqualsToMatcher
{
    public function __construct()
    {
        parent::__construct([
            'onGet',
            'onPost',
            'onPut',
            // ... （省略）
        ]);
    }
}
```

```
// 上記 `IsHttpMethodMatcher` のスーパークラス。
// 同一かどうかのカスタムマッチャー。
use Ray\Aop\AbstractMatcher;

class EqualsToMatcher extends AbstractMatcher
{
    /**
     * @var array
     */
    private $values;

    /**
     * @param string|array $values
     */
    public function __construct($values)
    {
        parent::__construct();

        $this->values = (array) $values;
    }

    /**
     * {@inheritdoc}
     */
    public function matchesClass(\ReflectionClass $class, array $arguments)
    {
        return in_array(strtolower($class->getName()), array_map('strtolower', $this->values));
    }

    /**
     * {@inheritdoc}
     */
    public function matchesMethod(\ReflectionMethod $method, array $arguments)
    {
        return in_array(strtolower($method->getShortName()), array_map('strtolower', $this->values));
    }
}
```

Copyright
---------

[](#copyright)

Copyright (c) 2019 Atsuhiro Kubo, Nana Yamane, All rights reserved.

License
-------

[](#license)

[The BSD 2-Clause License](http://opensource.org/licenses/BSD-2-Clause)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2344d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bd3464c256b95bb842a82ef692328939e24a91c7be6acb04cdbef1d49d89b44?d=identicon)[kumamidori](/maintainers/kumamidori)

---

Top Contributors

[![kumamidori](https://avatars.githubusercontent.com/u/384567?v=4)](https://github.com/kumamidori "kumamidori (2 commits)")

---

Tags

aopBEAR.SundayFormalBears

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/formal-bears-aop/health.svg)

```
[![Health](https://phpackages.com/badges/formal-bears-aop/health.svg)](https://phpackages.com/packages/formal-bears-aop)
```

###  Alternatives

[ocramius/proxy-manager

A library providing utilities to generate, instantiate and generally operate with Object Proxies

5.0k82.4M230](/packages/ocramius-proxy-manager)[friendsofphp/proxy-manager-lts

Adding support for a wider range of PHP versions to ocramius/proxy-manager

1.2k139.1M104](/packages/friendsofphp-proxy-manager-lts)[bear/package

BEAR.Sunday application framework package

30527.9k23](/packages/bear-package)[goaop/goaop-laravel-bridge

Integration bridge for Go! AOP framework

9420.6k](/packages/goaop-goaop-laravel-bridge)[marcelog/ding

PHP Dependency Injection based on Spring(tm), with Aspect Oriented Programming, MVC

1202.1k](/packages/marcelog-ding)[okapi/aop

PHP AOP is a PHP library that provides a powerful Aspect Oriented Programming (AOP) implementation for PHP.

3812.0k](/packages/okapi-aop)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
