定制 ininids/aam-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ininids/aam-php

最新稳定版本:2.5.1

Composer 安装命令:

composer require ininids/aam-php

包简介

AAM PHP bindings

README 文档

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.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: HTML

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-21