php_std/lib.rs
1//! PHP engine semantics in Rust.
2//!
3//! Utopia crates must behave exactly like their PHP libraries, and much of
4//! that behaviour comes from the PHP engine rather than the library: type
5//! juggling, `is_numeric`, `(string)` casts, loose comparison, `strtolower`,
6//! `mb_*`, `number_format`, `json_encode`/`json_decode`, `filter_var`,
7//! `parse_url`. Each is reimplemented here once, and Utopia crates use these
8//! functions instead of their own approximations.
9//!
10//! PHP values are [`Value`] ([`types`]): byte strings, ordered arrays with
11//! integer and string keys, `stdClass`, and crate-defined objects. The
12//! codecs ([`json`], [`serialize`], [`igbinary`]), comparisons and
13//! [`sort`] work on it. Older string-level helpers ([`value`], [`string`],
14//! [`format`], [`filter`]) take request-model `serde_json::Value`s, decoded
15//! the way `Utopia\Http\Request` decodes bodies (objects are associative
16//! arrays, except empty objects, which stay `stdClass`; [`Value::from_json`]
17//! is the same mapping).
18
19#![warn(missing_docs)]
20
21/// The getting started guide (`guide.md`), compiled and run with the doctests.
22#[cfg(doctest)]
23#[doc = include_str!("../guide.md")]
24pub struct GettingStarted;
25
26mod argon2;
27pub mod csv;
28pub mod datetime;
29pub mod encoding;
30pub mod filter;
31pub mod format;
32pub mod glob;
33pub mod igbinary;
34pub mod json;
35pub mod mb;
36pub mod net;
37pub mod number;
38pub mod path;
39pub mod pcre;
40pub mod random;
41pub mod serialize;
42pub mod sort;
43pub mod string;
44pub mod system;
45pub mod types;
46pub mod url;
47pub mod value;
48pub mod yaml;
49
50pub use types::{Array, ArrayKey, EngineError, Extension, Never, Str, Value};