ffi/location

PHP 库,用于确定二进制的物理位置

1.0.1 2023-01-01 13:49 UTC

This package is auto-updated.

Last update: 2024-08-29 17:37:10 UTC


README

PHP 8.1+ Latest Stable Version Latest Unstable Version Total Downloads License MIT

用于在操作系统中进行二进制文件搜索的库。

要求

  • PHP >= 7.4

安装

库作为 composer 仓库提供,可以在项目的根目录中使用以下命令进行安装。

$ composer require ffi/location

用法

存在性检查

检查库是否存在。

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