PHPackages                             larsgowebdev/wp-battery-cli - 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. larsgowebdev/wp-battery-cli

ActiveWordpress-plugin[CLI &amp; Console](/categories/cli)

larsgowebdev/wp-battery-cli
===========================

A WordPress CLI plugin for creating and managing WP-Battery components

0.7.0(1y ago)0140GPL-2.0-or-laterPHPPHP &gt;=8.1

Since Nov 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/larsgowebdev/wp-battery-cli)[ Packagist](https://packagist.org/packages/larsgowebdev/wp-battery-cli)[ RSS](/packages/larsgowebdev-wp-battery-cli/feed)WikiDiscussions production Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

WP-Battery CLI Plugin
=====================

[](#wp-battery-cli-plugin)

A WordPress CLI plugin that provides commands for creating and managing [WP-Battery](https://github.com/larsgowebdev/wp-battery) theme components. This plugin extends WP-CLI to streamline the development workflow with WP-Battery themes.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- WordPress &gt;= 6.5 (Composer-based), [Bedrock](https://github.com/roots/bedrock) recommended
    - WP-CLI installed and configured
- [WP-Battery](https://github.com/larsgowebdev/wp-battery) theme framework installed

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

[](#installation)

1. Install the plugin with composer:

```
composer require larsgowebdev/wp-battery-cli
```

2. Make sure the plugin is activated:

```
wp plugin activate wp-battery-cli
```

3. Verify installation:

```
wp help create-wpb-block
```

Available Commands
------------------

[](#available-commands)

### Initialize WP-Battery Structure

[](#initialize-wp-battery-structure)

Creates the required folder structure for a WP-Battery theme.

**Usage:**

```
wp init-wpb
```

This creates the following structure in your theme:

```
wpb/
├── acf-sync/
├── blocks/
├── cf7-templates/
├── menus/
├── options/
├── pages/
└── template-parts/

```

### Create Block

[](#create-block)

Creates a new block with required files and structure.

**Required arguments:**

- **--name**: Identifier of the block, it will be registered to that name and the folder structure will be named after it.
- **--title**: Name of the block, displayed in the WP admin area

**Usage:**

```
wp create-wpb-block --name=my-block --title="My Block"
```

**Creates:**

```
blocks/my-block/
├── assets/
    ├── my-block-script-all.js
    ├── my-block-script-editor.js
    ├── my-block-script-frontend.js
    ├── my-block-style-all.js
    ├── my-block-style-editor.js
    └── my-block-style-frontend.js
├── block.json
├── my-block-block-renderer.php
└── my-block-block-template.twig

```

### Create Page Template

[](#create-page-template)

Creates a new page template with required files.

**Required arguments:**

- **--name**: Identifier of the page, the template will be named after it.

**Usage:**

```
wp create-wpb-page --name=standard
```

**Creates:**

```
pages/standard/
├── standard-page-renderer.php
└── standard-page-template.twig

```

### Create Menu Configuration

[](#create-menu-configuration)

Creates a new menu configuration file.

**Required arguments:**

- **--name**: Identifier of the menu, the configuration file will be named after it

**Usage:**

```
wp create-wpb-menu --name=main
```

**Creates:**

```
menus/main-menu.php

```

### Create Options Page

[](#create-options-page)

Creates a new ACF options page configuration.

**Required arguments:**

- **--name**: Identifier of the options page, the configuration file will be named after it

**Usage:**

```
wp create-wpb-options --name=site
```

**Creates:**

```
options/site-options.php

```

### Create Custom Post Type

[](#create-custom-post-type)

Creates a custom post type configuration file to be automatically loaded by WP-Battery.

Required arguments:

- **--name**: Identifier of the post type, the configuration file will be named after it
- **--namespace**: Plugin/Theme namespace, for translations

**Usage:**

```
wp create-wpb-post-type --name=product --namespace=my-theme
```

**Creates:**

```
post-types/post-type-products.php

```

### Create Custom Taxonomy

[](#create-custom-taxonomy)

Creates a custom taxonomy configuration file to be automatically loaded by WP-Battery.

**Required arguments:**

- **--name**: Identifier of the taxonomy, the configuration file will be named after it
- **--namespace**: Plugin/Theme namespace, for translations
- **--post-type**: Which post type this taxonomy will be registered for
    - Note: Currently WP-Battery CLI only supports a single post type here. Of course, more can be added later.

**Usage:**

```
wp create-wpb-taxonomy --name=product-category --namespace=my-theme --post-type=product
```

**Creates:**

```
taxonomies/taxonomy-product-category.php

```

Naming Conventions
------------------

[](#naming-conventions)

All component names must follow these rules:

- Lowercase letters only
- Numbers allowed
- Hyphens and underscores allowed
- No spaces or special characters
- Cannot start or end with hyphen/underscore
- Cannot contain consecutive hyphens/underscores

Examples:

```
# Valid names
wp create-wpb-block --name=hero-section --title="Hero Section"
wp create-wpb-block --name=testimonials --title="Testimonials"
wp create-wpb-page --name=standard
wp create-wpb-menu --name=footer-menu
wp create-wpb-options --name=site
wp create-wpb-post-type --name=product --namespace=my-theme
wp create-wpb-taxonomy --name=product-category --namespace=my-theme --post-type=product

# Invalid names
wp create-wpb-block --name="Hero Section" # Contains spaces
wp create-wpb-block --name="MYBLOCK"      # Contains uppercase
wp create-wpb-block --name="-block-"      # Starts/ends with hyphen
```

---

Renderer Functions
------------------

[](#renderer-functions)

Both blocks and pages support custom render functions for data processing. These functions must:

- Contain the word 'render' in their name
- Accept one parameter ($context)
- Return the modified context

Example:

```
function render_my_component($context)
{
    $context['custom_data'] = 'value';
    return $context;
}
```

Safety Features
---------------

[](#safety-features)

- Prevents overwriting existing components
- Validates component names before creation
- Provides helpful error messages and suggestions
- Creates .gitkeep files in empty directories
- Adds appropriate .gitignore rules

Contributing
------------

[](#contributing)

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request

License
-------

[](#license)

This project is licensed under the GPL-2.0 License.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

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

Total

2

Last Release

550d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5acfe664cb331e88e051b4702323a39ac011b88183fb1237c7904035cb59c9a9?d=identicon)[larsgowebdev](/maintainers/larsgowebdev)

---

Top Contributors

[![larsgowebdev](https://avatars.githubusercontent.com/u/92448049?v=4)](https://github.com/larsgowebdev "larsgowebdev (5 commits)")

### Embed Badge

![Health badge](/badges/larsgowebdev-wp-battery-cli/health.svg)

```
[![Health](https://phpackages.com/badges/larsgowebdev-wp-battery-cli/health.svg)](https://phpackages.com/packages/larsgowebdev-wp-battery-cli)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)

PHPackages © 2026

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