2017 © Pedro Peláez
 

library object-proxy

A trait to simplify the creation of proxies or simple facades.

image

brightmachine/object-proxy

A trait to simplify the creation of proxies or simple facades.

  • Friday, October 31, 2014
  • by brightmachine
  • Repository
  • 2 Watchers
  • 1 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Rapper

What is Rapper?

This trait can help with writing facades where you want some methods to forward on to a target object or to create a proxy class, for example if you don't want to reference vendor code from within your domain., (*1)

Requirements

  • PHP 5.4+

Installation

Install composer in your project:, (*2)

curl -s http://getcomposer.org/installer | php

Create a composer.json file in your project root:, (*3)

{
    "require": {
        "brightmachine/rapper": "*"
    }
}

Install via composer:, (*4)

php composer.phar install

License

Rapper is open-sourced software licensed under the MIT License - see the LICENSE file for details, (*5)

Documentation

Currently this trait allows you to do the following:, (*6)

  1. set the target object for proxying to
  2. define a map of different function names to use

Example:, (*7)

<?php namespace Example;

use Monolog\Logger;
use BrightMachine\ObjectWrapper;

/**
 * Class Logger
 *
 * Proxy requests to Monolog/Logger
 *
 * @method mixed logMessage($msg) add a debug message
 * @package Example\Logger
 */
class Logger
{
    use ObjectWrapper;

    public function __construct ()
    {
        $target = new Logger('dev', $this->app['events']);
        $this->setTargetObject($target)
             ->setProxyFunctionMap([
                 'logMessage' => 'addDebug'
             ]);
    }
}

Contributing

Checkout master source code from github:, (*8)

hub clone brightmachine/rapper

Install development components via composer:, (*9)

# If you don't have composer.phar
./scripts/bundle-devtools.sh .

# If you have composer.phar
composer.phar install --dev

Coding Standard

We follows coding standard PSR-2., (*10)

Check if your codes follows PSR-2 by phpcs:, (*11)

./vendor/bin/phpcs --standard=PSR2 src/

Acknowledgement

Git repo skeleton by "Goodby Setup"., (*12)

The Versions

31/10 2014

dev-master

9999999-dev https://github.com/brightmachine/object-proxy

A trait to simplify the creation of proxies or simple facades.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

wrapper proxy object facade

31/10 2014

1.0.0

1.0.0.0 https://github.com/brightmachine/object-proxy

A trait to simplify the creation of proxies or simple facades.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

wrapper proxy object facade

24/04 2014

0.0.1

0.0.1.0 https://github.com/brightmachine/rapper

A trait to simplify the creation of proxies or simple facades.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

wrapper object facade rapper