• Stars
    star
    672
  • Rank 67,180 (Top 2 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 14 years ago
  • Updated 30 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A collection of tools to help with PHP command line utilities

PHP Command Line Tools

Build Status

A collection of functions and classes to assist with command line development.

Requirements

  • PHP >= 5.3

Suggested PHP extensions

  • mbstring - Used for calculating string widths.

Function List

  • cli\out($msg, ...)
  • cli\out_padded($msg, ...)
  • cli\err($msg, ...)
  • cli\line($msg = '', ...)
  • cli\input()
  • cli\prompt($question, $default = false, $marker = ':')
  • cli\choose($question, $choices = 'yn', $default = 'n')
  • cli\menu($items, $default = false, $title = 'Choose an Item')

Progress Indicators

  • cli\notify\Dots($msg, $dots = 3, $interval = 100)
  • cli\notify\Spinner($msg, $interval = 100)
  • cli\progress\Bar($msg, $total, $interval = 100)

Tabular Display

  • cli\Table::__construct(array $headers = null, array $rows = null)
  • cli\Table::setHeaders(array $headers)
  • cli\Table::setRows(array $rows)
  • cli\Table::setRenderer(cli\table\Renderer $renderer)
  • cli\Table::addRow(array $row)
  • cli\Table::sort($column)
  • cli\Table::display()

The display function will detect if output is piped and, if it is, render a tab delimited table instead of the ASCII table rendered for visual display.

You can also explicitly set the renderer used by calling cli\Table::setRenderer() and giving it an instance of one of the concrete cli\table\Renderer classes.

Tree Display

  • cli\Tree::__construct()
  • cli\Tree::setData(array $data)
  • cli\Tree::setRenderer(cli\tree\Renderer $renderer)
  • cli\Tree::render()
  • cli\Tree::display()

Argument Parser

Argument parsing uses a simple framework for taking a list of command line arguments, usually straight from $_SERVER['argv'], and parses the input against a set of defined rules.

Check examples/arguments.php for an example.

Usage

See examples/ directory for examples.

Todo

  • Expand this README
  • Add doc blocks to rest of code

More Repositories

1

wp-cli

βš™οΈ WP-CLI framework
PHP
4,866
star
2

profile-command

Quickly identify what's slow with WordPress
PHP
270
star
3

handbook

πŸ“– Complete documentation for WP-CLI
PHP
189
star
4

scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.
Gherkin
165
star
5

restful

Unlocking the potential of the WP REST API at the command line
PHP
150
star
6

doctor-command

Diagnose problems within WordPress by running a series of checks for symptoms
Gherkin
145
star
7

sample-plugin

Example plugin, generated using `wp scaffold plugin sample-plugin`
Shell
106
star
8

entity-command

Manage WordPress comments, menus, options, posts, sites, terms, and users.
PHP
100
star
9

i18n-command

Provides internationalization tools for WordPress projects.
Gherkin
96
star
10

extension-command

Manages plugins and themes, including installs, activations, and updates.
PHP
88
star
11

wp-cli-bundle

πŸ“¦ WP-CLI package that bundles the framework with a set of common commands
Gherkin
84
star
12

wp-config-transformer

Programmatically edit a wp-config.php file
PHP
80
star
13

db-command

Performs basic database operations using credentials stored in wp-config.php.
PHP
71
star
14

scaffold-package-command

Scaffolds WP-CLI commands with functional tests, full README.md, and more.
Gherkin
69
star
15

server-command

Launches PHP's built-in web server for a specific WordPress installation.
PHP
67
star
16

wp-super-cache-cli

A CLI interface for the WP Super Cache plugin
PHP
58
star
17

search-replace-command

Searches/replaces strings in the database.
Gherkin
57
star
18

core-command

Downloads, installs, updates, and manages a WordPress installation.
Gherkin
49
star
19

dist-archive-command

Create a distribution .zip or .tar.gz based on a plugin or theme's .distignore file
Gherkin
47
star
20

media-command

Imports files as attachments, regenerates thumbnails, or lists registered image sizes.
Gherkin
44
star
21

ideas

πŸ’‘ Ideas and feature requests are collected here
40
star
22

wp-cli-tests

WP-CLI testing framework
PHP
39
star
23

config-command

Generates and reads the wp-config.php file.
Gherkin
38
star
24

wp-cli-dev

πŸ›  WP-CLI development environment that allows for easy development across all packages
PHP
36
star
25

builds

Phar, Debian, and RPM builds of WP-CLI
36
star
26

package-index

A list of packages containing WP-CLI commands
Twig
31
star
27

checksum-command

Verifies file integrity by comparing to published checksums.
PHP
31
star
28

cron-command

Tests, runs, and deletes WP-Cron events; manages WP-Cron schedules.
PHP
31
star
29

wp-cli.github.com

wp-cli.org website
CSS
24
star
30

shell-command

Opens an interactive PHP console for running and testing PHP code.
PHP
20
star
31

import-command

Imports content from a given WXR file.
PHP
20
star
32

rewrite-command

Lists or flushes the site's rewrite rules, updates the permalink structure.
PHP
20
star
33

google-sitemap-generator-cli

A CLI interface for the Google Sitemap Generator plugin
Gherkin
18
star
34

package-command

Lists, installs, and removes WP-CLI packages.
PHP
17
star
35

find-command

Find WordPress installations on the filesystem
PHP
16
star
36

admin-command

Open /wp-admin/ in a browser
PHP
15
star
37

cache-command

Manages object and transient caches.
PHP
15
star
38

dash-docset-generator

WP-CLI Dash docset generator
PHP
14
star
39

language-command

Installs, activates, and manages language packs.
PHP
13
star
40

export-command

Exports WordPress content to a WXR file.
PHP
12
star
41

super-admin-command

Lists, adds, or removes super admin users on a multisite installation.
Gherkin
11
star
42

maintenance-mode-command

Activates, deactivates or checks the status of the maintenance mode of a site.
PHP
9
star
43

eval-command

Executes arbitrary PHP code or files.
Gherkin
8
star
44

embed-command

Inspects oEmbed providers, clears embed cache, and more.
Gherkin
7
star
45

.github

🌐 Centralized community health files for all repositories
6
star
46

widget-command

Adds, moves, and removes widgets; lists sidebars.
PHP
5
star
47

role-command

Adds, removes, lists, and resets roles and capabilities.
PHP
5
star
48

automated-tests

Runs the entire test suite on a regular basis
Shell
5
star
49

autoload-splitter

PHP
4
star
50

wp-cli-shim

This repository provides easy way to install WP-CLI without the risk of conflicting dependencies.
3
star
51

dashboard

Dashboard for WP-CLI contributors
HTML
2
star
52

wp-cli-roadmap

Roadmap planning for WP-CLI
2
star
53

sql-transform

PHP
1
star
54

getting-started-workshop

Dockerfile
1
star
55

reusable-workflow-test

Launches PHP's built-in web server for a specific WordPress installation.
PHP
1
star
56

rpm-build

Builds a RPM of the latest stable WP-CLI release
1
star
57

deb-build

1
star