PHPackages                             stevenwadejr/exposure - 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. stevenwadejr/exposure

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

stevenwadejr/exposure
=====================

Exposure acts as a proxy to protected and private properties and methods on an object.

0.3.0(10y ago)0158MITPHPPHP &gt;=5.4

Since Jul 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/stevenwadejr/Exposure)[ Packagist](https://packagist.org/packages/stevenwadejr/exposure)[ RSS](/packages/stevenwadejr-exposure/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

Exposure
========

[](#exposure)

> "Make your privates public".

Have you ever needed access to private/protected object properties or methods? Of course they're private/protected for a reason... but, sometimes you just *need* them.

**Exposure** *exposes* private and protected properties and methods as well as allowing for new methods to be added to an object *after* instantiation.

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

[](#installation)

Via Composer

```
composer require stevenwadejr/exposure

```

What's new in 0.3.0?
--------------------

[](#whats-new-in-030)

You can now expose your objects *and* benefit from type hinting. Exposure now comes with a factory to create a new instance of `Exposure` that extends your closed class.

Example:

```
use StevenWadeJr\Exposure\Factory;

class CantTouchThis
{
    private $privateParty = 'This is private';
}

$exposed = Factory::expose(new CantTouchThis);
```

```
echo $exposed->privateParty; // outputs 'This is private'
var_dump($exposed instanceof CantTouchThis); // outputs 'true'
```

Example
-------

[](#example)

```
