Oihana PHP Commands

BrewCommands uses ConstantsTrait

Enumeration of common Homebrew CLI commands.

This class provides constants representing frequently used Homebrew commands for package and service management on macOS and Linux. It can be used to standardize command usage across scripts and applications.

Example:

use oihana\commands\enums\BrewCommands;

// Install a package
shell_exec(BrewCommands::BREW_INSTALL . ' nginx');

// List all installed packages
$packages = shell_exec(BrewCommands::BREW_LIST);
echo $packages;

// Restart a service
shell_exec(BrewCommands::BREW_SERVICES_RESTART . ' nginx');
Tags
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Constants

BREW  = 'brew'
The 'brew' cli command.
BREW_CLEANUP  = 'brew cleanup'
Deletes old versions and unnecessary files.
BREW_DOCTOR  = 'brew doctor'
Diagnoses potential problems with your setup.
BREW_INSTALL  = 'brew install'
Installs a package (e.g., brew install nginx).
BREW_LIST  = 'brew list'
Lists all installed packages.
BREW_REINSTALL  = 'brew reinstall'
Reinstall a package.
BREW_SEARCH  = 'brew search'
Searches for packages.
BREW_SERVICES_CLEANUP  = 'brew services cleanup'
Cleans up unused service entries.
BREW_SERVICES_LIST  = 'brew services list'
Lists all services and their status (started/stopped).
BREW_SERVICES_RESTART  = 'brew services restart'
Restarts a service.
BREW_SERVICES_RUN  = 'brew services run'
Runs a service once (without autoloading on login).
BREW_SERVICES_START  = 'brew services start'
Starts a service and enables it to launch at login.
BREW_SERVICES_STOP  = 'brew services stop'
Stops a service.
BREW_UNINSTALL  = 'brew uninstall'
Uninstall a package (e.g., brew uninstall nginx).
BREW_UPDATE  = 'brew update'
Updates Homebrew’s local formula index.
BREW_UPGRADE  = 'brew upgrade'
Upgrades all outdated packages.

Constants

BREW_CLEANUP

Deletes old versions and unnecessary files.

public mixed BREW_CLEANUP = 'brew cleanup'

BREW_DOCTOR

Diagnoses potential problems with your setup.

public mixed BREW_DOCTOR = 'brew doctor'

BREW_INSTALL

Installs a package (e.g., brew install nginx).

public mixed BREW_INSTALL = 'brew install'

BREW_LIST

Lists all installed packages.

public mixed BREW_LIST = 'brew list'

BREW_REINSTALL

Reinstall a package.

public mixed BREW_REINSTALL = 'brew reinstall'

Searches for packages.

public mixed BREW_SEARCH = 'brew search'

BREW_SERVICES_CLEANUP

Cleans up unused service entries.

public mixed BREW_SERVICES_CLEANUP = 'brew services cleanup'

BREW_SERVICES_LIST

Lists all services and their status (started/stopped).

public mixed BREW_SERVICES_LIST = 'brew services list'

BREW_SERVICES_RESTART

Restarts a service.

public mixed BREW_SERVICES_RESTART = 'brew services restart'

BREW_SERVICES_RUN

Runs a service once (without autoloading on login).

public mixed BREW_SERVICES_RUN = 'brew services run'

BREW_SERVICES_START

Starts a service and enables it to launch at login.

public mixed BREW_SERVICES_START = 'brew services start'

BREW_SERVICES_STOP

Stops a service.

public mixed BREW_SERVICES_STOP = 'brew services stop'

BREW_UNINSTALL

Uninstall a package (e.g., brew uninstall nginx).

public mixed BREW_UNINSTALL = 'brew uninstall'

BREW_UPDATE

Updates Homebrew’s local formula index.

public mixed BREW_UPDATE = 'brew update'

BREW_UPGRADE

Upgrades all outdated packages.

public mixed BREW_UPGRADE = 'brew upgrade'

        
On this page

Search results