PHPackages                             appsignal/appsignal-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. appsignal/appsignal-php

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

appsignal/appsignal-php
=======================

AppSignal for PHP

v0.5.1(3w ago)06↓91.7%[2 issues](https://github.com/appsignal/appsignal-php/issues)MITPHPPHP &gt;=8.4.0CI passing

Since Mar 24Pushed 2w ago1 watchersCompare

[ Source](https://github.com/appsignal/appsignal-php)[ Packagist](https://packagist.org/packages/appsignal/appsignal-php)[ RSS](/packages/appsignal-appsignal-php/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (48)Versions (16)Used By (0)

AppSignal for PHP
=================

[](#appsignal-for-php)

The AppSignal for PHP library.

[![Tests](https://github.com/appsignal/appsignal-php/actions/workflows/ci.yml/badge.svg)](https://github.com/appsignal/appsignal-php/actions/workflows/ci.yml/badge.svg)

Requirements
------------

[](#requirements)

This package requires:

- PHP version &gt;= `8.4`
- `opentelemetry` extension

Installing `opentelemetry` PHP 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](https://docs.appsignal.com/php/installation.html#install-the-opentelemetry-php-extension) section in AppSignal Docs.

Installation
------------

[](#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
-----------

[](#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
-----------

[](#development)

### Installation

[](#installation-1)

This package uses [Composer](https://getcomposer.org) 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

[](#testing)

Run the following command in the root of this repository to run all [PHPUnit](https://phpunit.de/index.html) 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

[](#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
------------

[](#contributing)

Thinking of contributing to this repo? Awesome! 🚀

Please follow our [Contributing guide](http://docs.appsignal.com/appsignal/contributing.html) in our documentation and follow our [Code of Conduct](https://docs.appsignal.com/appsignal/code-of-conduct.html).

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](https://www.appsignal.com/waffles).

Support
-------

[](#support)

[Contact us](mailto:support@appsignal.com) 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.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance96

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

10

Last Release

22d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/912c2ac00770725316e710600fd57addf293a570d778aa28db2c38d72e1dae9a?d=identicon)[tombruijn](/maintainers/tombruijn)

![](https://www.gravatar.com/avatar/9f01adaec3c6214b94d26453996ef7635f3a6a9ada0bc036c601a3b4b86814e9?d=identicon)[martinlipskis](/maintainers/martinlipskis)

![](https://www.gravatar.com/avatar/b21542ab0030189978fb0d8304769429e141af6d952fb2744e6228f4dad34196?d=identicon)[as\_unflxw](/maintainers/as_unflxw)

---

Top Contributors

[![lipskis](https://avatars.githubusercontent.com/u/12170754?v=4)](https://github.com/lipskis "lipskis (79 commits)")[![tombruijn](https://avatars.githubusercontent.com/u/282402?v=4)](https://github.com/tombruijn "tombruijn (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/appsignal-appsignal-php/health.svg)

```
[![Health](https://phpackages.com/badges/appsignal-appsignal-php/health.svg)](https://phpackages.com/packages/appsignal-appsignal-php)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[spatie/flare-client-php

Send PHP errors to Flare

177156.9M21](/packages/spatie-flare-client-php)[lion/bundle

Lion-framework configuration and initialization package

122.3k3](/packages/lion-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
