ininids/aam-php

AAM PHP bindings

Maintainers

Package info

gitlab.com/aam-rs/aam-php

Issues

Language:HTML

pkg:composer/ininids/aam-php

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

2.5.1 2026-05-03 13:05 UTC

This package is auto-updated.

Last update: 2026-05-05 06:07:07 UTC


README

PHP bindings for aam-rs using FFI on top of the stable C API.

What you get

  • Parse AAM from strings.
  • Forward lookup (key -> value) and reverse lookup fallback (value -> key).
  • Simple zero-dependency wrapper class for scripting and prototyping.

Build native library

cargo build --release --features ffi

By default AamDocument reads the library from:

  • AAM_PHP_LIB env var, if present.
  • target/release/libaam_rs.so as fallback on Linux.

Basic usage

<?php

require_once 'php/src/AamPhp.php';

$aam = new RustGames\Aam\AamDocument("host = localhost\nport = 8080", '/absolute/path/to/libaam_rs.so');
echo $aam->get('host');
// localhost

More examples

<?php

require_once 'php/src/AamPhp.php';

$aam = new RustGames\Aam\AamDocument("env = production\nrole = api");

// direct lookup
var_dump($aam->get('env')); // "production"

// key/value lookup with fallback
var_dump($aam->find('production')); // ["env" => "production"]

// missing key
var_dump($aam->get('missing')); // null

Tests

AAM_RS_LIB=target/release/libaam_rs.so php php/tests/smoke.php

The smoke script includes multiple assertions for valid parsing, reverse lookup, missing keys, and invalid input errors.