# PHP OpenTelemetry APM

Learn how to migrate to OpenTelemetry for PHP.

Complete these tasks to properly integrate OpenTelemetry APM in PHP:

- [Install PHP](https://docs.kloudfuse.com/platform/3.3.6/agent-otel-migrate-php/#install)

- [Set Up Instrumentation](https://docs.kloudfuse.com/platform/3.3.6/agent-otel-migrate-php/#set-up)

- [Instrumentation Libraries](https://docs.kloudfuse.com/platform/3.3.6/agent-otel-migrate-php/#libraries)

- [Examples](https://docs.kloudfuse.com/platform/3.3.6/agent-otel-migrate-php/#examples)

## Install PHP

See OpenTelemetry documentation for [integrating through PHP](https://opentelemetry.io/docs/languages/php/getting-started/).

Run this command to install PHP:

```console
composer require open-telemetry/api open-telemetry/sem-conv
```

Copied!

## Set Up Instrumentation

OpenTelemetry documentation for [Instrumentation](https://opentelemetry.io/docs/languages/php/instrumentation/) clearly describes the basic steps for initializing a tracer and creating spans.

For creating spans using the OpenTelemetry API, the following section is useful: [Traces](https://opentelemetry.io/docs/languages/php/instrumentation/#traces).

## Instrumentation Libraries

We recommend that you review the OpenTelemetry documentation on [Using instrumentation libraries](https://opentelemetry.io/docs/languages/php/libraries/) to automatically instrument standard PHP packages.

## Examples

Common code scenarios and some example applications have been instrumented using OpenTelemetry, and shared in the OpenTelemetry documentation stack. See [Examples](https://github.com/open-telemetry/opentelemetry-php/tree/main/examples).
