Expand description
Build-time PHP detection utilities for ext-php-rs.
This crate provides utilities for detecting PHP installations and version information at build time. It is used by ext-php-rs’s build script and can be used by other crates that need to detect PHP at compile time.
§Example
use ext_php_rs_build::{find_php, PHPInfo, ApiVersion};
fn main() -> anyhow::Result<()> {
let php = find_php()?;
let info = PHPInfo::get(&php)?;
let version: ApiVersion = info.zend_version()?.try_into()?;
for api in version.supported_apis() {
println!("cargo:rustc-cfg={}", api.cfg_name());
}
Ok(())
}Structs§
- PHPInfo
- Output of
php -i.
Enums§
- ApiVersion
- PHP API version enum.
Functions§
- emit_
check_ cfg - Emits the cargo check-cfg directive for all PHP version flags.
- emit_
php_ cfg_ flags - Emits cargo cfg flags for the detected PHP version.
- emit_
rerun_ if_ env_ changed - Emits cargo rerun-if-env-changed for PHP-related environment variables.
- find_
executable - Finds the location of an executable
name. - find_
php - Finds the location of the PHP executable.
- path_
from_ env - Returns an environment variable’s value as a
PathBuf.