PHPackages                             halloverden/azure-application-insights - 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. halloverden/azure-application-insights

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

halloverden/azure-application-insights
======================================

This project extends the Application Insights API surface to support PHP.

0.1.4(3y ago)08131MITPHPPHP &gt;=7.4

Since Oct 23Pushed 3y ago3 watchersCompare

[ Source](https://github.com/halloverden/azure-application-insights)[ Packagist](https://packagist.org/packages/halloverden/azure-application-insights)[ Docs](https://github.com/Microsoft/ApplicationInsights-PHP)[ RSS](/packages/halloverden-azure-application-insights/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (3)Versions (6)Used By (1)

Azure Application Insights
==========================

[](#azure-application-insights)

This project was forked from and builds upon the official php sdk from windows, which is no longer mantained. As of now, it only supports exception logging.

About:
------

[](#about)

- [Azure Application Insights](https://azure.microsoft.com/services/application-insights/)
- [Official Github Repository From Microsoft](https://github.com/microsoft/ApplicationInsights-PHP)
- [Supported SDKs](https://docs.microsoft.com/en-us/azure/azure-monitor/app/platforms#unsupported-community-sdks)
- [GitHub Announcements](https://github.com/microsoft/ApplicationInsights-Announcements/issues)

Status
------

[](#status)

This SDK is NOT maintained or supported by Microsoft even though they've contributed to it in the past. Note that Azure Monitor only provides support when using supported SDKs.

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

[](#requirements)

- PHP version ^7.1

Installation
============

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Open a command console, enter your project directory and execute:

```
$ composer require halloverden/application-insights-sdk
```

Usage
-----

[](#usage)

Once installed, you can send exception telemetry to Application Insights. Here are a few samples.

> **Note**: before you can send data to you will need an instrumentation key. Please see the [Getting an Application Insights Instrumentation Key](https://github.com/Microsoft/AppInsights-Home/wiki#getting-an-application-insights-instrumentation-key) section for more information.

### Initializing the client and setting the instrumentation key and other optional configurations

[](#initializing-the-client-and-setting-the-instrumentation-key-and-other-optional-configurations)

```
$telemetryClient = new \ApplicationInsights\Telemetry_Client();
$context = $telemetryClient->getContext();

// Necessary
$context->setInstrumentationKey('YOUR INSTRUMENTATION KEY');

// Optional
$context->getSessionContext()->setId(session_id());
$context->getUserContext()->setId('YOUR USER ID');
$context->getApplicationContext()->setVer('YOUR VERSION');
$context->getLocationContext()->setIp('YOUR IP');

// Start tracking throwables
$telemetryClient->trackException($throwable);
$telemetryClient->flush();
```

### Setup Operation context

[](#setup-operation-context)

For correct Application Insights reporting you need to setup Operation Context, reference to Request

```
$telemetryClient->getContext()->getOperationContext()->setId('XX');
$telemetryClient->getContext()->getOperationContext()->setName('GET Index');
```

### Sending an exception telemetry, with custom properties and metrics

[](#sending-an-exception-telemetry-with-custom-properties-and-metrics)

```
try
{
    // Do something to throw an exception
}
catch (\Exception $ex)
{
    $telemetryClient->trackException($ex, ['InlineProperty' => 'test_value'], ['duration_inner' => 42.0]);
    $telemetryClient->flush();
}
```

### Set the Client to gzip the data before sending

[](#set-the-client-to-gzip-the-data-before-sending)

```
$telemetryClient->getChannel()->setSendGzipped(true);
```

### Registering an exception handler

[](#registering-an-exception-handler)

```
class Handle_Exceptions
{
    private $_telemetryClient;

    public function __construct()
    {
        $this->_telemetryClient = new \ApplicationInsights\Telemetry_Client();
        $this->_telemetryClient->getContext()->setInstrumentationKey('YOUR INSTRUMENTATION KEY');

        set_exception_handler(array($this, 'exceptionHandler'));
    }

    function exceptionHandler(\Exception $exception)
    {
        if ($exception != NULL)
        {
            $this->_telemetryClient->trackException($exception);
            $this->_telemetryClient->flush();
        }
    }
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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 ~151 days

Total

5

Last Release

1420d ago

PHP version history (2 changes)0.1.0PHP ^7.1

0.1.2PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/be037a51f809599999041698e48a3516363d070b3f4af00e1c90f067ac112b3c?d=identicon)[halloverden](/maintainers/halloverden)

![](https://www.gravatar.com/avatar/944da5ba62000d8d54fdeabb71bb8554596caabae0cadcc2433028105c5d80c8?d=identicon)[erichjsonfosse](/maintainers/erichjsonfosse)

---

Tags

application-insightsazureexceptionsphpsdklogloggingmonitoringInsightstelemetry

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/halloverden-azure-application-insights/health.svg)

```
[![Health](https://phpackages.com/badges/halloverden-azure-application-insights/health.svg)](https://phpackages.com/packages/halloverden-azure-application-insights)
```

###  Alternatives

[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[honeybadger-io/honeybadger-php

Honeybadger PHP library

381.5M4](/packages/honeybadger-io-honeybadger-php)[saasscaleup/laravel-log-alarm

Laravel log Alarm help you to set up alarm when errors occur in your system and send you a notification via Slack and email

27025.0k](/packages/saasscaleup-laravel-log-alarm)[lefuturiste/monolog-discord-handler

A simple monolog handler for support Discord webhooks

34111.6k4](/packages/lefuturiste-monolog-discord-handler)[oanhnn/laravel-logzio

Integrate Logz.io into PHP and Laravel 5.6+ Application

1062.8k](/packages/oanhnn-laravel-logzio)[hosmelq/laravel-logsnag

Integrate the power of LogSnag's real-time event tracking into your Laravel application.

237.9k](/packages/hosmelq-laravel-logsnag)

PHPackages © 2026

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