PHPackages                             mattmilesi/pt-osc-command-generator - 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. [Database &amp; ORM](/categories/database)
4. /
5. mattmilesi/pt-osc-command-generator

ActiveLibrary[Database &amp; ORM](/categories/database)

mattmilesi/pt-osc-command-generator
===================================

Generates pt-online-schema-change commands for MySQL, given the ALTER TABLE query

0.3.1(1y ago)17[2 PRs](https://github.com/mattmilesi/pt-osc-command-generator/pulls)Apache-2.0PHPPHP &gt;=7.4CI failing

Since Mar 3Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/mattmilesi/pt-osc-command-generator)[ Packagist](https://packagist.org/packages/mattmilesi/pt-osc-command-generator)[ RSS](/packages/mattmilesi-pt-osc-command-generator/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (7)Used By (0)

pt-command-generator
====================

[](#pt-command-generator)

Generates pt-online-schema-change commands for MySQL, given the ALTER TABLE query.

⚠️ This is an experimental version. Please, do not use it in production.

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

[](#installation)

```
composer require mattmilesi/pt-osc-command-generator
```

Usage
-----

[](#usage)

```
$query = "ALTER TABLE customers ADD COLUMN middle_name VARCHAR(255) NOT NULL AFTER first_name;";
$parser = new \PtOscCommandGenerator\StatementParser($query);
$command = $parser->getCommands()[0]
    ->setDsnOption(\PtOscCommandGenerator\DsnOption::HOST, '')
    ->setDsnOption(\PtOscCommandGenerator\DsnOption::DATABASE, '')
    ->setDsnOption(\PtOscCommandGenerator\DsnOption::USER, '')
    ->setDsnOption(\PtOscCommandGenerator\DsnOption::PASSWORD, '')
    ->setExecuteMode();
$cliCommand = (string)$command;

# getCommands returns an array of Command, each one representing a command to be executed
# $cliCommand: pt-online-schema-change --execute --alter "ADD COLUMN middle_name VARCHAR(255) NOT NULL AFTER first_name" h=,D=,t=customers,u=,p=
```

License
-------

[](#license)

This project is licensed under the Apache License 2.0.
However, it includes the `phpmyadmin/sql-parser` library, which is used under **GPL 3.0** to ensure compatibility.
See [GPL-3.0.txt](./GPL-3.0.txt) for details.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance59

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

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

Total

4

Last Release

479d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6038939?v=4)[Matteo Milesi](/maintainers/mattmilesi)[@mattmilesi](https://github.com/mattmilesi)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/mattmilesi-pt-osc-command-generator/health.svg)

```
[![Health](https://phpackages.com/badges/mattmilesi-pt-osc-command-generator/health.svg)](https://phpackages.com/packages/mattmilesi-pt-osc-command-generator)
```

###  Alternatives

[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

9410.8k](/packages/ahmed-bhs-doctrine-doctor)[phpmyadmin/phpmyadmin

A web interface for MySQL and MariaDB

34391.8k5](/packages/phpmyadmin-phpmyadmin)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

15118.7k4](/packages/calebdw-larastan)[soyuka/esql

PHP Extended Structured Query Language

932.1k](/packages/soyuka-esql)

PHPackages © 2026

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