定制 coral-media/ext-fann 二次开发

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

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

coral-media/ext-fann

Composer 安装命令:

pie install coral-media/ext-fann

包简介

FANN (Fast Artificial Neural Network) bindings for PHP

README 文档

README

coral-media/ext-fann is a PHP extension that wraps the Fast Artificial Neural Network (FANN) C library using vendored sources (lib/libfann).

Requirements

  • PHP >= 8.1
  • A C toolchain (phpize, make, compiler)
  • No system libfann-dev required (vendored build)

Install (PIE)

From the extension root:

pie install --with-fann

Build From Source (manual)

phpize
./configure --with-fann
make -j"$(nproc)"
make test

The extension module will be built as fann.

Minimal Example

<?php
$ann = fann_create_standard(3, 2, 3, 1);
fann_set_training_algorithm($ann, FANN_TRAIN_INCREMENTAL);
fann_set_learning_rate($ann, 0.7);
fann_set_activation_function_hidden($ann, FANN_SIGMOID_SYMMETRIC);
fann_set_activation_function_output($ann, FANN_SIGMOID_SYMMETRIC);

for ($epoch = 0; $epoch < 200; $epoch++) {
    fann_train($ann, [0.0, 0.0], [0.0]);
    fann_train($ann, [0.0, 1.0], [1.0]);
    fann_train($ann, [1.0, 0.0], [1.0]);
    fann_train($ann, [1.0, 1.0], [0.0]);
}

$out = fann_run($ann, [0.0, 1.0]);
var_dump($out);

fann_destroy($ann);

Tests

Run all PHPT tests:

make test

API Coverage

Implemented functions are grouped below. Full API reference: docs/api/index.md.

Network Creation, Persistence, and Lifecycle

Execution and Basic Training

Training Data I/O and Dataset Utilities

Training Metrics and Error Handling

Training Algorithm and Hyperparameters

Activation Functions and Steepness

Network Introspection, Topology, and Weights

Input/Output Scaling (Runtime + Parameter Setup)

Cascade Training Controls

Constants

  • Full exposure of currently registered FANN_* constants (training algorithms, activation functions, stop/error functions, net types, and error codes).

Vendored Dependency

  • FANN source is vendored under lib/libfann
  • License file: lib/libfann/COPYING.txt

coral-media/ext-fann 适用场景与选型建议

coral-media/ext-fann 是一款 基于 C 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「machine-learning」 「neural-network」 「fann」 「php-ext」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 coral-media/ext-fann 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 coral-media/ext-fann 我们能提供哪些服务?
定制开发 / 二次开发

基于 coral-media/ext-fann 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-14