PHPackages                             mikolajprzybysz/php-native-wrapper - 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. mikolajprzybysz/php-native-wrapper

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

mikolajprzybysz/php-native-wrapper
==================================

Object that wrappers every php native method.

v1.0.0(10y ago)016MITPHP

Since Oct 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mikolajprzybysz/php-native-wrapper)[ Packagist](https://packagist.org/packages/mikolajprzybysz/php-native-wrapper)[ Docs](https://github.com/mikolajprzybysz/php-native-wrapper)[ RSS](/packages/mikolajprzybysz-php-native-wrapper/feed)WikiDiscussions master Synced today

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

Abstract (about)
================

[](#abstract-about)

This project provides class that can be used to proxy calls to regular functions, therefore making them mockable like every other method call.

Install (include in composer)
=============================

[](#install-include-in-composer)

```
"require": {
    "mikolajprzybysz/php-native-wrapper": "^1.0.0"
}
```

How to use:
===========

[](#how-to-use)

1.Add `Native` class as dependency to the class using native calls

Via constructor

```
class SampleClass {
    /** @var Native */
    protected $native;
    public function __construct(Native $native){
        $this->native = $native;
    }
}
```

Via setter

```
class SampleClass {
    /** @var Native */
    protected $native;
    public function setNative(Native $native){
        $this->native = $native;
    }
}
```

2.Whenever you need to run native function, call it via $native instance:

```
class SampleClass {
    /** @var Native */
    protected $native;
    public function sampleMethod(){
        return $native->time();
    }
}
```

3.Mock it as any other class

```
class SampleClassTest extends \PHPUnit_Framework_TestCase {
    public function testSampleMethod(){
        $sampleTime = 123;
        $nativeMock = $this->getMock(Native::class);
        $nativeMock->expects($this->once())->method('time')->will($this->returnValue($sampleTime));
        $testObject = new SampleClass($nativeMock);
        $result = $testObject->sampleMethod();
        $this->assertEquals($sampleTime, $result);
    }
}
```

Unit test
=========

[](#unit-test)

```
./vendor/bin/phpunit test/MockTest.php --bootstrap vendor/autoload.php

```

Acceptance test
===============

[](#acceptance-test)

```
./vendor/bin/phpunit test/MockTest.php --bootstrap vendor/autoload.php

```

What it does not support
========================

[](#what-it-does-not-support)

- extract
- sort and any method using reference in it's arguments

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3899d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fd81c9a4cd0da4d4f13237c3309298f034068a7455c570925af8c8f607c47dda?d=identicon)[mikolajprzybysz](/maintainers/mikolajprzybysz)

---

Top Contributors

[![mikolajpe](https://avatars.githubusercontent.com/u/1093404?v=4)](https://github.com/mikolajpe "mikolajpe (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mikolajprzybysz-php-native-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/mikolajprzybysz-php-native-wrapper/health.svg)](https://phpackages.com/packages/mikolajprzybysz-php-native-wrapper)
```

###  Alternatives

[tolerance/tolerance

Fault tolerance library and micro-services helpers

1981.1M7](/packages/tolerance-tolerance)[slince/shipment-tracking

A flexible and awesome shipment tracking library for several carriers like DHL eCommerce, USPS, YanWen Express, Epacket, E包裹, E特快, 国际EMS, 快递100

281.6k4](/packages/slince-shipment-tracking)

PHPackages © 2026

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