PHPackages                             marcin-orlowski/lockpick - 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. marcin-orlowski/lockpick

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

marcin-orlowski/lockpick
========================

Helps accessing protected/private members/consts of foreign objects.

1.5.0(3mo ago)03.8k↑200%2MITPHPPHP ^8.1CI passing

Since Nov 4Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/MarcinOrlowski/php-lockpick)[ Packagist](https://packagist.org/packages/marcin-orlowski/lockpick)[ Docs](https://github.com/MarcinOrlowski/php-lockpick)[ RSS](/packages/marcin-orlowski-lockpick/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (10)Used By (2)

[![PHP Lockpick](img/logo-matrix-2-small.webp)](img/logo-matrix-2-small.webp)

Lockpick
========

[](#lockpick)

[![Latest Stable Version](https://camo.githubusercontent.com/cd4b9217163f3dd1652bffa4ec0728ed5f1a121226a5a5a4d3a7babeaab38db5/68747470733a2f2f706f7365722e707567782e6f72672f6d617263696e2d6f726c6f77736b692f6c6f636b7069636b2f762f737461626c65)](https://packagist.org/packages/marcin-orlowski/lockpick)[![License](https://camo.githubusercontent.com/4c29a6b5f725809fb503411f279c11e5d1ccec504a15d6b542cf894db85cc0be/68747470733a2f2f706f7365722e707567782e6f72672f6d617263696e2d6f726c6f77736b692f6c6f636b7069636b2f6c6963656e7365)](https://packagist.org/packages/marcin-orlowski/lockpick)

Collection of PHP helper methods allowing easy access to protected or private properties and constants of objects or classes as well as allowing to call such non-public methods. This library is mostly useful while creating unit tests for your code, therefore it is recommended to make it `--dev` only dependency.

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

[](#installation)

```
composer require --dev marcin-orlowski/lockpick
```

Usage
-----

[](#usage)

As all methods come as set of **static** methods, so you just need to add related `use` to your code class and all methods should be simply available via static reference `Lockpick::...`:

```
use Lockpick\Lockpick;
use PHPUnit\Framework\Assert;

$obj = new Stronghold();
$actual = Lockpick::call($obj, 'openSessame', [ 'abracadabra' ]);
Assert::assertEquals($expected, $actual);
...
```

Available methods
-----------------

[](#available-methods)

Notes:

- The `$clsOrObj` parameter can be either `object` or class name (`string`)
- The `Lockpick::call()` argument `$args` now accepts single parameters w/o `array` wrapping (so `call(..., $arg1)` is now valid and equivalent to `call(..., [ $arg1 ])`) as it will be automatically wrapped under the hood.
- If you want to actually pass `array` as single argument to called function you must wrap it into another array, like this: `call(..., [[ $arg1, $arg2 ]])`. Default is empty array which means no arguments will be passed to the called method.

MethodDescriptioncall($clsOrObj, string $methodName, mixed $args): mixedCalls object/class protected/private methodgetProperty($clsOrObj, string $name): mixedReturns value of protected/private propertysetProperty($clsOrObj, string $name, mixed $value): mixedSets value of protected/private propertygetConstant($clsOrObj, string $name): mixedReturns value of protected/private constantgetMethodVisibility($clsOrObj, string $name): VisibilityReturns visibility of class methodgetPropertyVisibility($clsOrObj, string $name): VisibilityReturns visibility of class propertygetConstantVisibility($clsOrObj, string $name): VisibilityReturns visibility of class constant---

License
-------

[](#license)

- Written and copyrighted ©2014-2026 by Marcin Orlowski
- Open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance86

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~169 days

Recently: every ~256 days

Total

8

Last Release

97d ago

PHP version history (2 changes)1.0.0PHP ^8.0||^8.1

1.3.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8870db56c4a0f54e86e6d574b761bac8654795bdad7b52b3ccdb6a42f0d4af80?d=identicon)[MarcinOrlowski](/maintainers/MarcinOrlowski)

---

Top Contributors

[![MarcinOrlowski](https://avatars.githubusercontent.com/u/8041294?v=4)](https://github.com/MarcinOrlowski "MarcinOrlowski (77 commits)")

---

Tags

helperconstantsprivatephp8protected

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/marcin-orlowski-lockpick/health.svg)

```
[![Health](https://phpackages.com/badges/marcin-orlowski-lockpick/health.svg)](https://phpackages.com/packages/marcin-orlowski-lockpick)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M681](/packages/barryvdh-laravel-ide-helper)[beste/json

A simple JSON helper to decode and encode JSON

4222.7M3](/packages/beste-json)[chillerlan/php-settings-container

A container class for immutable settings objects. Not a DI container.

3427.3M21](/packages/chillerlan-php-settings-container)

PHPackages © 2026

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