This simple PHP command allows you to list all loaded PHP extensions along with their versions. It utilizes the ReflectionExtension
class to provide detailed information about each extension.
php -r '$all = get_loaded_extensions(); foreach($all as $i) { $ext = new ReflectionExtension($i); $ver = $ext->getVersion(); echo "$i - $ver" . PHP_EOL;}'
The command iterates through all loaded extensions, retrieves version information using ReflectionExtension, and prints the extension name along with its version.
Core - 8.2.13
date - 8.2.13
libxml - 8.2.13
pcre - 8.2.13
zlib - 8.2.13
[...]
redis - 6.0.2
swoole - 5.1.1
Zend OPcache - 8.2.13
- Ensure that the PHP command is available in your terminal.
- The output includes extension names and their respective versions.
Feel free to customize and integrate this command into your PHP development workflow.