PHPackages                             leofeyer/optimize-native-functions-fixer - 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. leofeyer/optimize-native-functions-fixer

AbandonedArchivedLibrary

leofeyer/optimize-native-functions-fixer
========================================

Prefixes native PHP functions which can be replaced with opcodes by the OPcache.

1.1.1(8y ago)35.5k↑1900%15MITPHPPHP ^5.6|^7.0

Since Feb 7Pushed 7y ago1 watchersCompare

[ Source](https://github.com/leofeyer/optimize-native-functions-fixer)[ Packagist](https://packagist.org/packages/leofeyer/optimize-native-functions-fixer)[ RSS](/packages/leofeyer-optimize-native-functions-fixer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (15)

Deprecated
----------

[](#deprecated)

This package is no longer needed as the feature is now available in [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/3048). Use the `native_function_invocation` fixer with the `@compiler_optimized` option.

---

Optimize Native Functions Fixer
===============================

[](#optimize-native-functions-fixer)

About
-----

[](#about)

This custom PHP-CS-Fixer fixer prefixes native PHP functions which can be replaced with opcodes by the OPcache.

```
class MyClass
{
    public function isArray($var): bool
    {
        return \is_array($var);
    }
}
```

See [this pull request](https://github.com/symfony/symfony/pull/25854) to learn how prefixing an optimizable PHP function made the Symfony DI container 783ms faster. And see [this pull request](https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/3048) if you want to learn more about how the optimization works.

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

[](#installation)

Add the package via Composer:

```
php composer.phar require leofeyer/optimize-native-functions-fixer --dev
```

Configuration
-------------

[](#configuration)

Modify your `.php_cs` or `.php_cs.dist` file as follows:

```
return PhpCsFixer\Config::create()
    ->setRules([
        // …
        'LeoFeyer/optimize_native_functions' => true,
    ])
    ->registerCustomFixers([
        new LeoFeyer\PhpCsFixer\OptimizeNativeFunctionsFixer()
    ])
    ->setRiskyAllowed(true)
```

Other options
-------------

[](#other-options)

If you do not like prefixing native functions, you can also import them with a `use` statement (PHP 7 only).

```
use function is_array;

class MyClass
{
    public function isArray($var): bool
    {
        return is_array($var);
    }
}
```

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity61

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 ~7 days

Total

4

Last Release

2990d ago

PHP version history (3 changes)1.0.0PHP ^7.1

1.0.1PHP ^7.0

1.1.0PHP ^5.6|^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3de3a0dd7c29df679eb280585220c17c1a7340b46c2792d5e8298be859acfbba?d=identicon)[leofeyer](/maintainers/leofeyer)

---

Top Contributors

[![leofeyer](https://avatars.githubusercontent.com/u/1192057?v=4)](https://github.com/leofeyer "leofeyer (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/leofeyer-optimize-native-functions-fixer/health.svg)

```
[![Health](https://phpackages.com/badges/leofeyer-optimize-native-functions-fixer/health.svg)](https://phpackages.com/packages/leofeyer-optimize-native-functions-fixer)
```

###  Alternatives

[kubawerlos/php-cs-fixer-custom-fixers

A set of custom fixers for PHP CS Fixer

23812.0M144](/packages/kubawerlos-php-cs-fixer-custom-fixers)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[ergebnis/php-cs-fixer-config

Provides a configuration factory and rule set factories for friendsofphp/php-cs-fixer.

692.9M162](/packages/ergebnis-php-cs-fixer-config)[slam/php-cs-fixer-extensions

Slam extension of friendsofphp/php-cs-fixer

68947.7k20](/packages/slam-php-cs-fixer-extensions)[jubeki/laravel-code-style

Combine Custom Fixers with the ruleset of Laravel Pint to fix your code style in Laravel Applications/Packages.

56521.7k8](/packages/jubeki-laravel-code-style)[redaxo/php-cs-fixer-config

php-cs-fixer config for REDAXO

1091.3k7](/packages/redaxo-php-cs-fixer-config)

PHPackages © 2026

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