ext-php-rs-build 0.1.1

Build-time PHP detection utilities for ext-php-rs.
Documentation
  • Coverage
  • 100%
    27 out of 27 items documented1 out of 21 items with examples
  • Size
  • Source code size: 12.82 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.13 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • extphprs/ext-php-rs
    795 87 11
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ptondereau Xenira

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