PHP library for determining the physical location of binaries
Library for searching binary files in the operating system.
- PHP >= 7.4
Library is available as composer repository and can be installed using the following command in a root of your project.
$ composer require ffi/location
Checking the library for existence.
use FFI\Location\Locator; $exists = Locator::exists('libGL.so'); // Expected true in the case that the binary exists and false otherwise
Getting the full path to the library.
use FFI\Location\Locator; $pathname = Locator::pathname('libGL.so'); // Expected "/usr/lib/x86_64-linux-gnu/libGL.so.1.7.0" or null // in the case that the library cannot be found
Checking multiple names to find the most suitable library.
use FFI\Location\Locator; $pathname = Locator::resolve('example.so', 'test.so', 'libvulkan.so'); // Expected "/usr/lib/x86_64-linux-gnu/libvulkan.so.1.2.131" or null // in the case that the library cannot be found