# PHP

> pulse-si/php is the shared core of the Laravel and Symfony packages, with the worker and the shared folder. For PHP without a framework, use the heartbeat.

- Section: Packages
- Availability: PHP 8.1 or later, with Laravel or Symfony.
- URL: https://pulse-app.si/en/docs/packages/php

## What pulse-si/php is

`pulse-si/php` is installed with [pulse-si/laravel](https://pulse-app.si/en/docs/packages/laravel) or [pulse-si/symfony](https://pulse-app.si/en/docs/packages/symfony). It’s the part that talks to the API. You don’t need to install it yourself.

## PHP without Laravel or Symfony

`pulse-si/php` has no command or entry point of its own, and for PHP the API only accepts the package names `pulse-laravel` and `pulse-symfony`. For another PHP app, use an [address](https://pulse-app.si/en/docs/apps/url) or the [heartbeat](https://pulse-app.si/en/docs/apps/signal): create the app with **A heartbeat**, then call this address from a cron.

**zsh**

```bash
curl -fsS -X POST https://api.pulse-app.si/ingest/heartbeat -H "Authorization: Bearer pk_live_…"
```

## How it works

A PHP request is too short to carry a report, so the work is split between a long-running worker and your other processes, which communicate through a local folder.

| Process | What it does |
| --- | --- |
| The worker (`pulse-app:work`, `pulse:work`) | Runs the checks, sends reports and logs, follows the API’s pace. |
| The scheduler, the queue, web requests | Write job runs and logs to the local folder. They never talk to Pulse. |
| The local folder (`storage/pulse/`, `var/pulse/`) | Holds job runs, logs (1000 lines and 1 MB at most) and the API’s last response. |

All these processes must see the same folder and the same `PULSE_KEY`. If the worker stops, the shared state expires and log copying turns off, without blocking anything.

## PHP extensions

Only `json` is required. The others enable a feature or make one safer.

| Extension | Used for | Without it |
| --- | --- | --- |
| `json` | The report format | The package won’t install. |
| `curl` | Sending reports | Falls back to PHP streams. |
| `sodium`, `openssl` | Secure mode | The worker refuses to start if `PULSE_PUBLIC_KEY` is set, so nothing is sent in the clear. |
| `openssl` | Pinning a relay (`PULSE_RELAY_FINGERPRINT`) | The worker refuses to start if the fingerprint is set. |
| `pcntl` | Clean worker shutdown, strict probe timeouts | The worker stops on the signal without finishing its send. A slow probe is marked as failed afterward. |

Log copying goes through a Monolog handler, which Laravel and Symfony provide.

## What can go wrong

The package never interrupts your app. If Pulse can’t be reached, you get a single warning and the worker keeps retrying. If the key is refused, the worker stops. Restart it with the new key. If the worker isn’t running, Pulse stops receiving anything and alerts you as it would for any silent app.

- [Laravel](https://pulse-app.si/en/docs/packages/laravel): Install, start the worker, configure.
- [Symfony](https://pulse-app.si/en/docs/packages/symfony): Add the bundle, start the worker, configure.
- [Heartbeat signal](https://pulse-app.si/en/docs/apps/signal): For a script or a scheduled job.
