PHPackages                             intahwebz/weaver - 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. intahwebz/weaver

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

intahwebz/weaver
================

An experiment in compositional programming.

0.4.5(11y ago)0403[2 issues](https://github.com/Danack/Weaver/issues)MITPHPPHP &gt;=5.4.0

Since Dec 29Pushed 11y ago1 watchersCompare

[ Source](https://github.com/Danack/Weaver)[ Packagist](https://packagist.org/packages/intahwebz/weaver)[ Docs](https://github.com/danack/Weaver)[ RSS](/packages/intahwebz-weaver/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (8)Versions (14)Used By (0)

Weaver
======

[](#weaver)

An experiment in compositional programming. Inspired by  and

[![Build Status](https://camo.githubusercontent.com/b4a353c02ae36aa386ad247d89c085eb322f0283e85845e20530a48980141dca/68747470733a2f2f7472617669732d63692e6f72672f44616e61636b2f5765617665722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Danack/Weaver)

Why?
----

[](#why)

The two projects listed above are both good ideas, but have serious limitations. The phpProxyBuilder is does not generate correct type-hinting information, which completely stops me from being able to use it.

The ProxyManager is nice, but has issues with how it interacts with other code and seems to make debugging code incredibly hard. I also couldn't see how to implement a caching proxy.

This project is an attempt to allow generating various types of decorated versions of classes with a goal of:

- Great flexibility on how they're used.
- Retaining ability to debug code.
- Low overhead both mentally and by code weight.
- Keep type-hinting intact to allow [Auryn DI](https://github.com/rdlowrey/Auryn) to work correctly.

Example
-------

[](#example)

We have a class and we want to be able to time the calls to 'executeQuery'

```

class TestClass {

    function __construct($statement, $createLine){
        $this->statement = $statement;
        $this->createLine = $createLine;
    }

    function executeQuery($queryString, $foo2) {
        echo "executing query!";

        return 5;
    }
}

```

Weaved with a 'class' to that holds a timer:

```
