Skip to content

Commit d7589e2

Browse files
committed
Add 'Why not just use ini_get()?' section to README
1 parent 7ebc642 commit d7589e2

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,28 @@ foreach ($info->modules() as $module) {
184184
echo '</ul>';
185185
}
186186
```
187+
188+
## Why not just use `ini_get()` or `extension_loaded()`?
189+
190+
PHP scatters its configuration across a handful of narrow functions, each with its own scope:
191+
192+
| Function | What it gives you |
193+
|---|---|
194+
| `ini_get()` | A single INI value — and only the local (effective) value |
195+
| `extension_loaded()` | Whether an extension is loaded (boolean) |
196+
| `get_loaded_extensions()` | A list of extension names — no configuration details |
197+
| `phpversion()` | The PHP version string |
198+
| `php_uname()` | OS info |
199+
200+
Every one of these requires you to **know exactly what you're asking for ahead of time**. There's no way to discover what's available, iterate over all configuration, or search across modules.
201+
202+
And even if you combine all of them, there are things they simply **cannot tell you** — the configure command PHP was compiled with, Zend extension details, stream wrappers, registered filters, and per-extension metadata that only `phpinfo()` exposes.
203+
204+
`phpinfo()` is the **only** function that gives you everything in one place. The problem is it outputs raw HTML (or plain text in CLI) with no API to work with.
205+
206+
This package parses that complete `phpinfo()` output and gives you:
207+
208+
- **Discovery without foreknowledge** — iterate over all modules and configs without knowing what's installed
209+
- **Both local and master values**`ini_get()` only returns the effective local value; this package gives you both so you can see what was overridden
210+
- **Access to phpinfo()-only data** — compile options, stream wrappers, registered filters, and other details that no other PHP function exposes
211+
- **A single, consistent API** — instead of juggling five different functions with different return types, query everything through one interface

0 commit comments

Comments
 (0)