PHPackages                             magewirephp/portman - 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. [CLI &amp; Console](/categories/cli)
4. /
5. magewirephp/portman

ActiveProject[CLI &amp; Console](/categories/cli)

magewirephp/portman
===================

Portman is a command-line utility that simplifies porting PHP libraries between frameworks.

0.5.12(5mo ago)3492[9 PRs](https://github.com/magewirephp/portman/pulls)MITPHPCI passing

Since Jun 23Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/magewirephp/portman)[ Packagist](https://packagist.org/packages/magewirephp/portman)[ GitHub Sponsors](https://github.com/wpoortman)[ RSS](/packages/magewirephp-portman/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (17)Versions (35)Used By (0)

Portman
=======

[](#portman)

Portman is a command-line utility that simplifies porting PHP libraries between frameworks.

### Contents

[](#contents)

- [Installing](#electric_plug-installing)
- [Configure](#gear-configure)
    - [Options](#options)
    - [Filtering files](#filtering-files)
    - [Environment file](#environment-file)
- [Usage](#tada-usage)
    - [Download-source](#download-source)
    - [Build](#build)
    - [Watch](#watch)
- [Contributing](#pencil2-contributing)
- [Code of Conduct](#book-code-of-conduct)
- [Made possible by using](#bulb-made-possible-by-using)
    - [Nikic PHP-Parser](#nikic-php-parser)
    - [Laravel Zero](#laravel-zero)
    - [Webmozart Glob](#webmozart-glob)
    - [Spatie Laravel-data](#spatie-laravel-data)

🔌 Installing
------------

[](#electric_plug-installing)

```
composer require --dev magewirephp/portman
```

You can run it from your bin directory:

```
vendor/bin/portman
```

Or download the `portman` executable from the [releases](https://github.com/magewirephp/portman/releases) section and run it from the terminal.

⚙️ Configure
------------

[](#gear-configure)

Portman works with `portman.config.php` config file. You can create it manually, or let Portman create it for you:

```
vendor/bin/portman init
```

### Options

[](#options)

```
return [
    'directories' => [
        'source' => [
            'foo' => [
                'composer' => [ // if you want to download the sources from packagist
                    'name'   => 'example/package', // package name
                    'version'   => '^0.1.0', // the version constraint to download
                    'version-lock'   => '0.1.0', // a locked version (not required :))
                    'base-path'   => 'src', // the base-path to copy to the source-directory
                ],
                'glob'   => '**/*.php', // only php files
                'ignore' => [
                    'DontIncludeMe/**/*' // but nothing from 'DontIncludeMe'
                ]
            ],
            'bar' // the whole directory
        ], // directories where the original source code lives
        'augmentation' => ['baz'], // directories with the code that overwrites the original classes
        'additional' => [], // directories with extra code that is just additional code to copy to the dist
        'output' => 'dist' // directories with extra code that is just additional code to copy to the dist
    ],
    'transformations' => [
        'Foo\\' => [
            'rename'          => 'Baz\\', // rename the Foo namespace to Baz
            'file-doc-block' => '/** Readme */', // add a doc-block to all the files in Foo
            'children'        => [
                'Bar' => [
                    'rename'            => 'Baz', // rename class Bar to Baz (with the namespace change it was Foo\Bar and becomes Baz\Baz)
                    'remove-methods'    => ['unnecessaryBazMethod'] // remove the method from the class,
                    'remove-properties' => ['unnecessaryProperty'] // remove the property from the class,
                ]
            ]
        ]
    ],
    'post-processors' => [
        'rector'       => false, // should run Rector after build/watch?
        'php-cs-fixer' => false, // should run PHP-CS-Fixer after build/watch?
    ]
];
```

### Filtering files

[](#filtering-files)

If you want to be more precise into what files or folders to include from the directories you can use the 'ant-like glob' functionality provided by '[webmozarts/glob](https://github.com/webmozarts/glob)':

```
return [
    'directories' => [
        'source' => [
            'foo' => [
                'glob'   => '**/*.php', // only php files
                'ignore' => [
                    'DontIncludeMe/**/*' // but nothing from 'DontIncludeMe'
                    '!DontIncludeMe/PleaseAddMe.php' // Except for the 'PleaseAddMe' file in 'DontIncludeMe'
                ]
            ],
            'bar' // the whole directory
        ], // directories where the original source code lives
        ...
    ],
    ...
];
```

Here you can see a global 'glob' definition(`'glob'   => '**/*.php'`) that will only include php files from the `foo` source directory.

But the `ignore` array specifies globs for files to ignore. The ignore globs will stack. Globs starting with a `!` will negate the ignored files from previous ignore rules. So given the configuration above and this folder structure:

```
foo
  ClassFoo.php
  Namespace
    ClassBar.php
  DontIncludeMe
    PleaseAddMe.php
    ClassBaz.php
    ClassRemoved.php

```

The files `DontIncludeMe\ClassBaz.php` and `DontIncludeMe\ClassRemoved.php` will be ignored.

### Environment file

[](#environment-file)

If you want to store the configuration in a different location you can set the `PORTMAN_CONFIG_FILE` environment variable.

🎉 Usage
-------

[](#tada-usage)

Just use Portman and check its commands:

```
vendor/bin/portman
```

### Download-source

[](#download-source)

The `download-source` command will download the source-code from packagist.

Warning

This will overwrite the source-code directory, so make sure to backup!

```
vendor/bin/portman download-source
```

### Build

[](#build)

The `build` command will merge all code into the output-directory.

```
vendor/bin/portman build
```

### Watch

[](#watch)

The `watch` command will watch for changes in any of the source/augmentation/addition directories and run the build process for the changed files.

To use `watch` you will need to install [chokidar-cli](https://www.npmjs.com/package/chokidar-cli) into the project folder

```
npm install chokidar-cli
```

Or globally

```
npm install -g chokidar-cli
```

Using the `watch` command:

```
vendor/bin/portman watch
```

✏️ Contributing
---------------

[](#pencil2-contributing)

Thank you for considering contributing to Portman! Please read the [contribution guide](https://github.com/magewirephp/portman/blob/main/CONTRIBUTING.md) to know how to behave, install and use Portman for contributors.

📖 Code of Conduct
-----------------

[](#book-code-of-conduct)

In order to ensure that the Portman is welcoming to all, please review and abide by the [Code of Conduct](https://github.com/magewirephp/portman/blob/main/CODE_OF_CONDUCT.md).

💡 Made possible by using
------------------------

[](#bulb-made-possible-by-using)

### Nikic PHP-Parser

[](#nikic-php-parser)

[PHP-Parser](https://github.com/nikic/PHP-Parser) is used to parse source and augmentation php classes, to merge them afterwards. Created by [Nikita Popov](https://github.com/nikic)

### Laravel Zero

[](#laravel-zero)

[Laravel Zero](https://laravel-zero.com/) is the command line utility base. Created by [Nuno Maduro](https://github.com/nunomaduro) and [Owen Voke](https://github.com/owenvoke).

### Webmozart Glob

[](#webmozart-glob)

[Webmozart Glob](https://github.com/webmozarts/glob) is used for finding and filtering files using Ant's glob.

### Spatie Laravel-data

[](#spatie-laravel-data)

[Spatie Laravel-data](https://spatie.be/docs/laravel-data) is used to validate and make the `portman.config.php` files into handy DTO's.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance78

Regular maintenance activity

Popularity14

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.1% 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 ~25 days

Recently: every ~47 days

Total

22

Last Release

166d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/91219612?v=4)[Magewire PHP](/maintainers/magewirephp)[@magewirephp](https://github.com/magewirephp)

---

Top Contributors

[![JustinElst](https://avatars.githubusercontent.com/u/249633?v=4)](https://github.com/JustinElst "JustinElst (204 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (51 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (26 commits)")[![wpoortman](https://avatars.githubusercontent.com/u/5383956?v=4)](https://github.com/wpoortman "wpoortman (4 commits)")[![michielgerritsen](https://avatars.githubusercontent.com/u/5858697?v=4)](https://github.com/michielgerritsen "michielgerritsen (2 commits)")

---

Tags

phpporting

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/magewirephp-portman/health.svg)

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

###  Alternatives

[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[nunomaduro/laravel-console-task

Laravel Console Task is a output method for your Laravel/Laravel Zero commands.

2582.1M11](/packages/nunomaduro-laravel-console-task)[mehrancodes/laravel-harbor

A CLI tool to Quickly create On-Demand preview environment for your apps.

9989.0k](/packages/mehrancodes-laravel-harbor)[alecrabbit/php-cli-snake

Lightweight cli spinner with zero dependencies

29211.3k5](/packages/alecrabbit-php-cli-snake)

PHPackages © 2026

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