PHPackages                             huangdijia/invade - 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. huangdijia/invade

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

huangdijia/invade
=================

A PHP function to work with private properties and methods

v2.0.1(2y ago)07MITPHPPHP ^8.1

Since Aug 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/huangdijia/invade)[ Packagist](https://packagist.org/packages/huangdijia/invade)[ Docs](https://github.com/huangdijia/invade)[ RSS](/packages/huangdijia-invade/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (4)Dependencies (3)Versions (6)Used By (0)

A PHP function to access private properties and methods
=======================================================

[](#a-php-function-to-access-private-properties-and-methods)

[![Latest Test](https://github.com/huangdijia/invade/workflows/tests/badge.svg)](https://github.com/huangdijia/invade/actions)[![Latest Stable Version](https://camo.githubusercontent.com/668cf484a41ba7e098863f564e119a5cdc20f4df54db0349bdb9df21873ef775/68747470733a2f2f706f7365722e707567782e6f72672f6875616e6764696a69612f696e766164652f762f737461626c652e737667)](https://packagist.org/packages/huangdijia/invade)[![Latest Unstable Version](https://camo.githubusercontent.com/3bb5abb3f625bb5f4ef2095ed16e8503c10ff9c6dddfcd8a485668b3c598b9db/68747470733a2f2f706f7365722e707567782e6f72672f6875616e6764696a69612f696e766164652f762f756e737461626c652e737667)](https://packagist.org/packages/huangdijia/invade)[![Total Downloads](https://camo.githubusercontent.com/0e72eb9ac3a29a76bab480b3554fa3d6a29bba657b9a0b45f7779e7703a0d49f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6875616e6764696a69612f696e76616465)](https://packagist.org/packages/huangdijia/invade)[![License](https://camo.githubusercontent.com/03233ef6a703bb4dc63e6ca928ac5b54c37ac3ae4ec99028ebbe886097af8059/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6875616e6764696a69612f696e76616465)](https://github.com/huangdijia/invade)

This package offers an `invade` function that will allow you to read/write private properties of an object. It will also allow you to call private methods.

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

[](#installation)

You can install the package via composer:

```
composer require huangdijia/invade
```

Usage
-----

[](#usage)

Imagine you have this class defined which has a private property and method.

```
