PHPackages                             stevebauman/unfinalize - 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. stevebauman/unfinalize

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

stevebauman/unfinalize
======================

Permanently remove final keywords from vendor packages.

v2.2.0(5mo ago)14423.1k—8.3%5MITPHPPHP ^8.1CI failing

Since Sep 27Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/stevebauman/unfinalize)[ Packagist](https://packagist.org/packages/stevebauman/unfinalize)[ RSS](/packages/stevebauman-unfinalize/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (8)Versions (7)Used By (0)

Unfinalize
==========

[](#unfinalize)

Unleash the freedom lost with open source PHP packages marking classes and methods as `final`.

[![](https://camo.githubusercontent.com/88c846ead36fc61fe9dbe575bea4c17dfe5fcc77bc9a58ffb823de15eb4285f9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73746576656261756d616e2f756e66696e616c697a652f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/stevebauman/unfinalize/actions)[![](https://camo.githubusercontent.com/70f691ce89dd797e60eb4a633abc862fa5676983f36107886720dc327c70f95a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746576656261756d616e2f756e66696e616c697a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stevebauman/unfinalize)[![](https://camo.githubusercontent.com/016af4460eff5328cfd1a9bbc8e9e22bbacc236862e096bb16c9c9d238655314/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746576656261756d616e2f756e66696e616c697a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stevebauman/unfinalize)[![](https://camo.githubusercontent.com/56cec26119046a5c390da39eb202e5a2cb410d19924014312cde131eef531cd2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73746576656261756d616e2f756e66696e616c697a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stevebauman/unfinalize)

---

Unfinalize uses [PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) to permanently remove `final` keywords from composer vendor packages:

```
- final class Foo
+ class Foo
{
-   final public function bar()
+   public function bar()
    {
        // ...
    }
}
```

- Updates to PHP files are done safely, quickly, and performant.
- Changes are stored permanently. There is no performance impact using Unfinalize.
- No additional dependencies to your application. Unfinalize and its dependencies are [compiled into a single phar file](https://github.com/stevebauman/unfinalize/blob/master/builds).

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

[](#installation)

```
composer require stevebauman/unfinalize
```

Usage
-----

[](#usage)

You may unfinalize files using two different methods: [file paths](#file-paths), or [package paths](#package-paths).

### File Paths

[](#file-paths)

Using files paths allow you to unfinalize specific files or directories by specifying them in the command:

```
php vendor/bin/unfinalize run vendor/package/src/File.php
```

You may unfinalize multiple files or directories by separating them by a space:

```
php vendor/bin/unfinalize run vendor/package/src/Foo/ vendor/package/src/Bar/File.php
```

To make sure this is always done on your project's dependencies, add the command to your `composer.json` file in the `scripts` property:

```
{
  "scripts": {
    "post-update-cmd": [
      "@php vendor/bin/unfinalize run vendor/package/src/Foo/ vendor/package/src/Bar/File.php"
    ]
  }
}
```

Then run `composer update`.

### Package Paths

[](#package-paths)

Using package paths allow you to unfinalize entire packages by specifying them in your `composer.json` file.

Add the vendor packages you want to remove the final keywords from inside an `unfinalize` property:

```
{
    "unfinalize": [
        "vendor/package"
    ]
}
```

Add the unfinalize command to your `composer.json` so it runs on `composer update`:

```
{
  "scripts": {
    "post-update-cmd": [
      "@php vendor/bin/unfinalize run"
    ]
  }
}
```

Then, run `composer update`.

### Options

[](#options)

#### `--annotate={annotation}`

[](#--annotateannotation)

If you would like final classes and methods to be marked with an annotation (`@{annotation}`) doc block after unfinalizing, you may add the `--annotate` option to the unfinalize command:

> If an annotation already exists in a doc block then it will be left untouched.

```
{
  "scripts": {
    "post-update-cmd": [
      "@php vendor/bin/unfinalize run --annotate=internal"
    ]
  }
}
```

Which will produce:

**Before**:

```
final class Foo
{
    final public function bar()
    {
        // ...
    }
}
```

**After**:

```
/**
 * @internal
 */
class Foo
{
    /**
     * @internal
     */
    public function bar()
    {
        // ...
    }
}
```

#### `--properties={protected/public}`

[](#--propertiesprotectedpublic)

If you would like to change the visibility of `private` properties to `protected` or `public`, you may add the `--properties` option to the unfinalize command with the new visibility to assign:

```
{
  "scripts": {
    "post-update-cmd": [
      "@php vendor/bin/unfinalize run --properties=protected"
    ]
  }
}
```

Which will produce:

**Before**:

```
class Foo
{
    private $bar;
}
```

**After**:

```
class Foo
{
    protected $bar;
}
```

#### `--methods={protected/public}`

[](#--methodsprotectedpublic)

If you would like to change the visibility of `private` methods to `protected` or `public`, you may add the `--methods` option to the unfinalize command with the new visibility to assign:

```
{
  "scripts": {
    "post-update-cmd": [
      "@php vendor/bin/unfinalize run --methods=public"
    ]
  }
}
```

Which will produce:

**Before**:

```
class Foo
{
    private function bar()
    {
    }
}
```

**After**:

```
class Foo
{
    public function bar()
    {
    }
}
```

#### `--dry`

[](#--dry)

Execute a dry run to see what files will be modified by Unfinalize:

```
vendor/bin/unfinalize run --dry
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance71

Regular maintenance activity

Popularity42

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.6% 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 ~160 days

Recently: every ~195 days

Total

6

Last Release

161d ago

Major Versions

v1.0.0 → v2.0.02023-10-21

### Community

Maintainers

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

---

Top Contributors

[![stevebauman](https://avatars.githubusercontent.com/u/6421846?v=4)](https://github.com/stevebauman "stevebauman (70 commits)")[![lode](https://avatars.githubusercontent.com/u/511245?v=4)](https://github.com/lode "lode (1 commits)")

---

Tags

fixerphp-cs-fixerfinalunfinalize

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/stevebauman-unfinalize/health.svg)

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

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k234.7M20.6k](/packages/friendsofphp-php-cs-fixer)[stechstudio/laravel-php-cs-fixer

Easily format your Laravel Code with this Configuration file and accompanying artisan command.

146718.6k2](/packages/stechstudio-laravel-php-cs-fixer)[jolicode/jolitypo

Microtypography fixer for the web.

3471.1M5](/packages/jolicode-jolitypo)[typo3/coding-standards

A set of coding guidelines for any TYPO3-related project or extension

662.8M379](/packages/typo3-coding-standards)[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)[fadion/fixerio

Wrapper for Fixer.io

49337.7k](/packages/fadion-fixerio)

PHPackages © 2026

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