Attribute Macro ext_php_rs::php_const

source ·
#[php_const]
Expand description

Attribute used to annotate constants to be exported to PHP.

The declared constant is left intact (apart from the addition of the #[allow(dead_code)] attribute in the case that you do not use the Rust constant).

These declarations must happen before you declare your php_startup function (or php_module function if you do not have a startup function).

§Example

#[php_const]
const TEST_CONSTANT: i32 = 100;

#[php_const]
const ANOTHER_CONST: &str = "Hello, world!";