appsignal/appsignal-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

appsignal/appsignal-php

Composer 安装命令:

composer require appsignal/appsignal-php

包简介

AppSignal for PHP

README 文档

README

The AppSignal for PHP library.

Tests

Requirements

This package requires:

  • PHP version >= 8.4
  • opentelemetry extension

Installing opentelemetry PHP extension

First, make sure the build dependencies required to install the OpenTelemetry PHP extension are installed.

On Ubuntu/Debian:

sudo apt-get install gcc make autoconf

or macOS:

brew install gcc make autoconf

Then, install the OpenTelemetry PHP extension using PECL:

pecl install opentelemetry

Finally, enable the extension in php.ini

[opentelemetry]
extension=opentelemetry.so

For more ways to install opentelemetry extension (pie, pickle, Docker), see the Installing the OpenTelemetry extension section in AppSignal Docs.

Installation

Install the latest version of AppSignal with:

composer require appsignal/appsignal-php

After that, run:

vendor/bin/appsignal install

This command will scaffold a config file in config/appsignal.php, install auto-instrumentations for your application framework (Laravel or Symfony) and send example data to AppSignal.

Basic usage

use Appsignal\Appsignal;

// add a custom instrumentation span to the current trace
Appsignal::instrument('some_event', closure: fn() => sleep(1));

// add a custom instrumentation span to the current trace with data
Appsignal::instrument('some_event', ['region' => 'eu'], closure: fn() => sleep(1));

// customize the name of the trace
Appsignal::setAction('my action'),

// add attributes to the current span
Appsignal::addAttributes([
    'string-attribute' => 'abcdef',
    'int-attribute' => 1234,
    'bool-attribute' => true,
]);

// add tags to the current span
Appsignal::addTags([
    'string-tag' => 'some value',
    'integer-tag' => 1234,
    'bool-tag' => true,
]);

// report a handled exception
Appsignal::setError($exception);

// add metrics
Appsignal::setGauge('my_gauge', 12);
Appsignal::setGauge('my_gauge_with_attributes', 13, ['region' => 'eu']);

Appsignal::addDistributionValue('memory_usage', 50);
Appsignal::addDistributionValue('memory_usage', 70);

Appsignal::addDistributionValue('with_attributes', 10, ['region' => 'eu']);
Appsignal::addDistributionValue('with_attributes', 20, ['region' => 'eu']);
Appsignal::addDistributionValue('with_attributes', 30, ['region' => 'eu']);

Appsignal::incrementCounter('my_counter', 1);
Appsignal::incrementCounter('my_counter', 3, ['region' => 'eu']);

Development

Installation

This package uses Composer as the dependency manager. Once you have Composer installed, install all dependencies:

composer install

If you'd rather not install PHP and Composer locally, you can run Composer commands in a Docker container using the scripts/call_composer command:

scripts/call_composer any_composer_command_or_script

Testing

Run the following command in the root of this repository to run all PHPUnit tests:

composer test

# or with Docker
scripts/test

or run a single test file:

composer test tests/Path/To/YourTest.php

# or with Docker
scripts/test tests/Path/To/YourTest.php

or a single test case:

composer test --filter testMethodName

# or with Docker
scripts/test --filter testMethodName

This package supports PHP versions >= 8.4. If you want to run tests against a specific version of PHP, pass PHP_VERSION environment variable to the scripts/test command:

PHP_VERSION=8.5 scripts/test

Linting

You can run PHPStan anaylzer:

composer lint

# or with Docker
scripts/call_composer lint

or run PHP Coding Standards Fixer:

composer cs                    # check
composer cs:fix                # fix

# or with Docker
scripts/call_composer cs       # check
scripts/call_composer cs:fix   # fix

Contributing

Thinking of contributing to this repo? Awesome! 🚀

Please follow our Contributing guide in our documentation and follow our Code of Conduct.

Also, we would be very happy to send you Stroopwafels. Have look at everyone we have sent a package to so far on our Stroopwafels page.

Support

Contact us and speak directly with the engineers working on AppSignal. They will help you get set up, tweak your code and make sure you get the most out of using AppSignal.

appsignal/appsignal-php 适用场景与选型建议

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

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

围绕 appsignal/appsignal-php 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

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