PHP code example of ffi / location

1. Go to this page and download the library: Download ffi/location library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ffi / location example snippets


use FFI\Location\Locator;

$exists = Locator::exists('libGL.so');
// Expected true in the case that the binary exists and false otherwise

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

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