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(())
}