PHPackages                             piotrpress/accessor - 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. piotrpress/accessor

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

piotrpress/accessor
===================

This library provides an access to protected/private, also static, methods/properties of an object/class.

v1.0.0(5y ago)043GPL-3.0PHPPHP &gt;=7.4

Since Jan 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/PiotrPress/accessor)[ Packagist](https://packagist.org/packages/piotrpress/accessor)[ Docs](https://PiotrPress)[ RSS](/packages/piotrpress-accessor/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Accessor
========

[](#accessor)

This library provides an access to protected/private, also static, methods/properties of an object/class.

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

[](#installation)

```
composer require piotrpress/accessor
```

Usage
-----

[](#usage)

### Example class

[](#example-class)

```
class Example {
    private $privateProperty = 'privateProperty';
    protected $protectedProperty = 'protectedProperty';
    static private $staticPrivateProperty = 'staticPrivateProperty';
    static protected $staticProtectedProperty = 'staticProtectedProperty';

    private function privateMethod( $arg1, $arg2 ) { echo $arg1 . $arg2; }
    protected function protectedMethod( $arg1, $arg2 ) { echo $arg1 . $arg2; }
    static private function staticPrivateMethod( $arg1, $arg2 ) { echo $arg1 . $arg2; }
    static protected function staticProtectedMethod( $arg1, $arg2 ) { echo $arg1 . $arg2; }
}
```

### Including library

[](#including-library)

```
require __DIR__ . '/vendor/autoload.php';

use PiotrPress\Accessor;
```

### Calling methods

[](#calling-methods)

```
$accessor = new Accessor( new Example() );

$accessor->privateMethod( 'arg1', 'arg2' );
$accessor->protectedMethod( 'arg1', 'arg2' );
```

### Calling static methods

[](#calling-static-methods)

```
$accessor = new Accessor( 'Example' );

$accessor->staticPrivateMethod( 'arg1', 'arg2' );
$accessor->staticProtectedMethod( 'arg1', 'arg2' );
```

### Getting properties

[](#getting-properties)

```
$accessor = new Accessor( new Example() );

echo $accessor->privateProperty;
echo $accessor->protectedProperty;
```

### Getting static properties

[](#getting-static-properties)

```
$accessor = new Accessor( 'Example' );

echo $accessor->staticPrivateProperty;
echo $accessor->staticProtectedProperty;
```

### Setting properties

[](#setting-properties)

```
$accessor = new Accessor( new Example() );

$accessor->privateProperty = 'newPrivateProperty';
$accessor->protectedProperty = 'newProtectedProperty';
```

### Setting static properties

[](#setting-static-properties)

```
$accessor = new Accessor( 'Example' );

$accessor->staticPrivateProperty = 'newStaticPrivateProperty';
$accessor->staticProtectedProperty = 'newStaticProtectedProperty';
```

License
-------

[](#license)

GPL3.0

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

1939d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10326736?v=4)[Piotr Niewiadomski](/maintainers/PiotrPress)[@PiotrPress](https://github.com/PiotrPress)

---

Top Contributors

[![PiotrPress](https://avatars.githubusercontent.com/u/10326736?v=4)](https://github.com/PiotrPress "PiotrPress (1 commits)")

---

Tags

accessaccessorcallcallerinvokeinvokernon-public-methodnon-public-propertyprivateprivate-methodprivate-propertyprotectedprotected-methodprotected-propertystatic-private-methodstatic-private-propertystatic-protected-methodstatic-protected-propertyinvokeinvokeraccessaccessorprivatecallprotectedcallerprotected methodprotected propertynon public methodnon public propertyprivate methodstatic protected methodstatic private methodprivate propertystatic protected propertystatic private property

### Embed Badge

![Health badge](/badges/piotrpress-accessor/health.svg)

```
[![Health](https://phpackages.com/badges/piotrpress-accessor/health.svg)](https://phpackages.com/packages/piotrpress-accessor)
```

###  Alternatives

[symfony/property-access

Provides functions to read and write from/to an object or array using a simple string notation

2.8k295.3M2.5k](/packages/symfony-property-access)[php-di/invoker

Generic and extensible callable invoker

26857.8M56](/packages/php-di-invoker)[dflydev/dot-access-data

Given a deep data structure, access data by dot notation.

718359.1M86](/packages/dflydev-dot-access-data)[ffraenz/private-composer-installer

A composer install helper for private packages

2331.7M5](/packages/ffraenz-private-composer-installer)[rybakit/arguments-resolver

ArgumentsResolver allows you to determine the arguments to pass to a function or method.

26107.7k7](/packages/rybakit-arguments-resolver)

PHPackages © 2026

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