PHPackages                             ruelluna/wpsage - 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. ruelluna/wpsage

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

ruelluna/wpsage
===============

WordPress-aware CLI for idempotent database patches (Sage-friendly)

1.0.2(3mo ago)04MITPHPPHP &gt;=8.3

Since Apr 17Pushed 3mo agoCompare

[ Source](https://github.com/ruelluna/wpsage)[ Packagist](https://packagist.org/packages/ruelluna/wpsage)[ Docs](https://github.com/ruelluna/wpsage)[ RSS](/packages/ruelluna-wpsage/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

wpsage
======

[](#wpsage)

WordPress-aware CLI for running ordered, tracked PHP patches. When `ruelluna/wpsage` is installed in a **Sage theme** (via that theme’s `composer.json`), the default patch folder is **`database/patches` at the theme root** (next to `composer.json`). If the package is only installed at the WordPress root, the default is `database/patches` under the WordPress root instead. Patches can call WordPress APIs after bootstrap.

Install
-------

[](#install)

Require the package in the same Composer project where you run the CLI (typically your **Sage theme** directory, or the WordPress root if you use a root `composer.json`). Then run `composer install` so `vendor/autoload.php` exists.

From your **WordPress root** (directory containing `wp-load.php`), if Composer lives there:

```
composer require ruelluna/wpsage
```

Or add a path / VCS repository while developing:

```
{
  "repositories": [
    { "type": "path", "url": "../wpsage" }
  ],
  "require": {
    "ruelluna/wpsage": "@dev"
  }
}
```

Usage
-----

[](#usage)

```
vendor/bin/wpsage patch:install
vendor/bin/wpsage patch:run
vendor/bin/wpsage patch:rollback
vendor/bin/wpsage patch:rollback --step=3
```

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

[](#configuration)

Defaults:

- Patches directory: `database/patches`, relative to the **Sage theme root** when the CLI is run from a theme install (`style.css` + `composer.json` or `app/` is detected above `vendor/`), otherwise relative to the **WordPress root**
- Tracking table: `{wpdb_prefix}wpsage_patches`

Override with a **`wpsage.php`** file at the WordPress root that returns an array. Paths are relative to the theme root when wpsage is installed in a theme (same base as the default); you can set an **absolute** `patches_directory` if patches live under the WordPress root instead.

```
