Files
masimmo.pl/modules/x13webp/vendor/rosell-dk/locate-binaries
Jacek Pyziak 3b29a79921 Add X13 WebP module for image conversion to next-generation formats
- Implemented the main module class with essential properties and methods.
- Added translation support for various user interface strings.
- Created XML configuration file for module versioning.
- Ensured compatibility with different PHP versions and PrestaShop versions.
2025-10-16 21:30:24 +02:00
..

Locate Binaries

Build Status Coverage Software License Latest Stable Version Minimum PHP Version

Just a little class for locating binaries. You need exec(), shell_exec() or similar enabled for it to work. Otherwise, it will throw.

Works on Linux, Windows and Mac.

Usage

To locate installed cwebp binaries (found on Linux with which -a, falling back to whereis -b; on Windows found using where):

$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 C:\Windows\System32 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');

Notes

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 :)

Thanks!