Locate a binaries by means of exec() or similar
Installs: 311 399
Open Issues: 1
- php: >=5.6
- rosell-dk/exec-with-fallback: ^1.0.0
- rosell-dk/file-util: ^0.1.0
- friendsofphp/php-cs-fixer: ^2.11
- phpstan/phpstan: ^1.5
- phpunit/phpunit: ^9.3
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2023-03-20 10:51:15 UTC
Just a little class for locating binaries.
shell_exec() or similar enabled for it to work. Otherwise, it will throw.
Works on Linux, Windows and Mac.
To locate installed
cwebp binaries (found on Linux with
which -a, falling back to
whereis -b; on Windows found using
use LocateBinaries\LocateBinaries; $cwebBinariesFound = LocateBinaries::locateInstalledBinaries('cwebp');
Note that you get an array of matches - there may be several versions of a binary on a system.
The library also adds another method for locating binaries by peeking in common system paths, such as usr/bin and
However, beware that these dirs could be subject to open_basedir restrictions which can lead to warning entries in the error log. The other method is therefore best.
Well warned, here it is the alternative, which you in some cases might want to fall back to after trying the first.
$imagickBinariesFound = LocateBinaries::locateInCommonSystemPaths('convert');
Install with composer:
composer require rosell-dk/locate-binaries
The library uses the exec-with-fallback library in order to be able to use alternatives to exec() when exec() is disabled.
Do you like what I do?
Perhaps you want to support my work, so I can continue doing it :)