PHPackages                             nyholm/nsa - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. nyholm/nsa

ActiveLibrary[Testing &amp; Quality](/categories/testing)

nyholm/nsa
==========

See everything and do whatever you want. No privacy rule will stop us. Used in tests, debugging and fixtures to access properties and methods.

1.4.0(5mo ago)2286.4M↓44.3%11[1 PRs](https://github.com/Nyholm/NSA/pulls)20MITPHPPHP &gt;=7.1CI failing

Since Aug 6Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/Nyholm/NSA)[ Packagist](https://packagist.org/packages/nyholm/nsa)[ Docs](https://tnyholm.se)[ GitHub Sponsors](https://github.com/nyholm)[ RSS](/packages/nyholm-nsa/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (8)Dependencies (4)Versions (10)Used By (20)

NSA; See and do whatever you want. Great for writing tests
==========================================================

[](#nsa-see-and-do-whatever-you-want-great-for-writing-tests)

[![Latest Version](https://camo.githubusercontent.com/8133ea51d42816b9511bfb151ba14ea5deb153fa07cb9ece4dae952e32ac3a34/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f4e79686f6c6d2f4e53412e7376673f7374796c653d666c61742d737175617265)](https://github.com/Nyholm/NSA/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Tests](https://github.com/Nyholm/NSA/actions/workflows/ci.yml/badge.svg)](https://github.com/Nyholm/NSA/actions/workflows/ci.yml)[![Code Coverage](https://camo.githubusercontent.com/a4d32fe4d70e3bbcdb6504fd1b7b1790c1b9c0ffe6844013bc32b347c5f5cd91/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f4e79686f6c6d2f4e53412e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Nyholm/NSA)[![Quality Score](https://camo.githubusercontent.com/b94860b0b31723cd2b45e0f0a0a9175235c80f29c5ea2971528132885ed625d6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4e79686f6c6d2f4e53412e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Nyholm/NSA)[![Total Downloads](https://camo.githubusercontent.com/c1b4113f126b44f449bc7efe14532eb58628d6f5b673aa7763f113d77f9c5afe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e79686f6c6d2f6e73612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nyholm/nsa)

This small class helps you to test your private and protected properties and methods. One could argue that you never should test private methods but sometimes it just makes the test code a lot cleaner and easier to write and understand. This library is all about DX.

Usage
-----

[](#usage)

```
$object = new Dog();

NSA::setProperty($object, 'name', 'Foobar');
$name = NSA::getProperty($object, 'name');
$result = NSA::invokeMethod($object, 'doAction', 'jump', '1 meter');

echo $name; // "Foobar"
echo $result; // "Dog just did 'jump' for 1 meter"

// Access static properties and methods
$age = NSA::getProperty('\Dog', 'age');
echo $age; // 12
```

```
class Dog
{
    private $name = 'unnamed';
    private static $age = 12;

    private function doAction($action, $parameter)
    {
        return sprintf("Dog just did '%s' for %s", $action, $parameter);
    }
}
```

Install
-------

[](#install)

```
$ composer require nyholm/nsa
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance78

Regular maintenance activity

Popularity61

Solid adoption and visibility

Community35

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 74% 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 ~500 days

Recently: every ~526 days

Total

8

Last Release

159d ago

PHP version history (3 changes)1.0.0PHP ^5.3 || ^7.0

1.2.0PHP ^7.1

1.2.1PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/401ccc5eea13c60cf807ae982af00e368e2166e2f26d8eb541dcd881a57385bc?d=identicon)[Nyholm](/maintainers/Nyholm)

---

Top Contributors

[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (37 commits)")[![carlos-ea](https://avatars.githubusercontent.com/u/5512089?v=4)](https://github.com/carlos-ea "carlos-ea (7 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (3 commits)")[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (1 commits)")[![ktom](https://avatars.githubusercontent.com/u/1516685?v=4)](https://github.com/ktom "ktom (1 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (1 commits)")

---

Tags

testFixturedebugreflection

### Embed Badge

![Health badge](/badges/nyholm-nsa/health.svg)

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

###  Alternatives

[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k30.0M2.9k](/packages/infection-infection)[nelmio/alice

Expressive fixtures generator

2.5k45.8M176](/packages/nelmio-alice)[phparkitect/phparkitect

Enforce architectural constraints in your PHP applications

9244.5M32](/packages/phparkitect-phparkitect)[zenstruck/foundry

A model factory library for creating expressive, auto-completable, on-demand dev/test fixtures with Symfony and Doctrine.

79714.3M173](/packages/zenstruck-foundry)[trappar/alice-generator

Automatically generates alice fixture based on a set of objects

52185.5k1](/packages/trappar-alice-generator)[trappar/alice-generator-bundle

Symfony bundle for generating Alice fixtures from Doctrine entities

45169.8k1](/packages/trappar-alice-generator-bundle)

PHPackages © 2026

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