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. mattmilesi/pt-osc-command-generator

ActiveLibrary

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 passing

Since Mar 3Pushed 3mo 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 1mo ago

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

29

—

LowBetter than 60% of packages

Maintenance69

Regular maintenance activity

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

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

424d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/82f51e96aa8a45676b5505c7226bb0d90a972a31982094cf54f211c4cc3abc69?d=identicon)[mattmilesi](/maintainers/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.

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

A web interface for MySQL and MariaDB

15378.5k4](/packages/phpmyadmin-phpmyadmin)[calebdw/larastan

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

1484.6k3](/packages/calebdw-larastan)

PHPackages © 2026

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