phpquery
Query PHP configuration and information
TLDR
List available PHP versions
List available SAPIs for PHP 7.3
List enabled extensions for PHP 7.3 with the cli SAPI
Check if the JSON extension is enabled for PHP 7.3 with the apache2 SAPI
SYNOPSIS
phpquery [options] [php_code]
PARAMETERS
-a
Interactive mode (not always a standard option)
[php_code]
Directly execute the PHP code provided as a command-line argument. If no code is supplied, it typically starts an interactive session.
-h or --help
Display help information. Shows usage and available options, if implemented.
-v or --version
Display version information, if implemented.
DESCRIPTION
phpquery provides an interactive command-line environment for executing PHP code. It allows you to quickly test snippets of PHP code, debug functions, or even build small scripts without the overhead of creating separate files. Think of it as a PHP REPL (Read-Eval-Print Loop) but possibly implemented using a shell script. Its primary advantage lies in its ease of use and rapid prototyping capabilities directly from your terminal. It's particularly helpful when experimenting with new PHP features or libraries. Unlike a full-fledged PHP interpreter, phpquery often relies on a shell environment to execute the PHP code. It leverages the existing PHP installation on your system, invoking the PHP interpreter through shell commands. The implementation details vary, but the core goal remains the same: providing an interactive PHP environment in the terminal.
CAVEATS
phpquery is often implemented as a shell script, so the specific options and behavior can vary significantly based on the version and installation.
Error messages may not be as informative as in a full PHP environment.
It may not support all PHP features or extensions without proper configuration. It might be limited by shell environment settings.
INSTALLATION
Installation usually involves downloading the shell script or using a package manager if a package is available. Ensure the script is executable and in your system's PATH for easy access.
EXAMPLE USAGE
To start an interactive session: phpquery (or sometimes phpquery -a). To execute a single line of code: phpquery 'echo "Hello, world!";'
HISTORY
The specific history of phpquery is often less well-documented than the PHP interpreter itself. Its origins usually lie in the need for a quick, interactive PHP testing environment. It likely emerged as a community-driven tool, with variations developed by different individuals to suit their needs. Given the possible implementation using shell scripts, adoption is driven by popularity and maintenance effort.