PHPackages                             dapr/php-sdk - 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. dapr/php-sdk

ActiveLibrary

dapr/php-sdk
============

Dapr Implementation in PHP

v1.2.0(4y ago)7480.5k↓10.5%17[14 issues](https://github.com/dapr/php-sdk/issues)[1 PRs](https://github.com/dapr/php-sdk/pulls)6MITPHPPHP ^8.0CI passing

Since Jan 29Pushed 10mo ago9 watchersCompare

[ Source](https://github.com/dapr/php-sdk)[ Packagist](https://packagist.org/packages/dapr/php-sdk)[ RSS](/packages/dapr-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (13)Versions (15)Used By (6)

Using this library
==================

[](#using-this-library)

[![PHP Composer](https://github.com/dapr/php-sdk/actions/workflows/php.yml/badge.svg)](https://github.com/dapr/php-sdk/actions/workflows/php.yml)

This library is licensed with the MIT license.

Add the library to your `composer.json`:

> composer require dapr/php-sdk

Some basic documentation is below, more documentation can be found [in the docs](https://docs.dapr.io/developing-applications/sdks/php/);

Migrating to 1.2
================

[](#migrating-to-12)

In preparation for gRPC support in this SDK, there's now a new DaprClient in `\Dapr\Client\DaprClient`. Please update your code to use the new client.

There shouldn't be many changes to your code to upgrade to 1.2+ from a prior version. Namely, there are some deprecations:

Deprecations
------------

[](#deprecations)

The following have been deprecated and will be removed in 1.4+.

### \\Dapr\\SecretManager has been deprecated

[](#daprsecretmanager-has-been-deprecated)

Simply use the new client instead.

### \\Dapr\\Client has been deprecated

[](#daprclient-has-been-deprecated)

Simply use the new client: `\Dapr\Client\DaprClient`.

### \\Dapr\\PubSub\\Publish has been deprecated

[](#daprpubsubpublish-has-been-deprecated)

Simply instantiate `\Dapr\PubSub\Topic` directly or use the new client directly.

Fallbacks and Upgrades
----------------------

[](#fallbacks-and-upgrades)

### \\Dapr\\State\\StateManager

[](#daprstatestatemanager)

This class has been upgraded to use the new client. It shouldn't require any changes to your code, however, the old behavior can be utilized with `\Dapr\State\StateManagerOld`.

### \\Dapr\\State\\TransactionalState

[](#daprstatetransactionalstate)

This class has been upgrade to use the new client. It shouldn't require any changes to your code, however, the old behavior can be utilized with `\Dapr\State\TransactionalStateOld`.

Creating a Dapr Client
======================

[](#creating-a-dapr-client)

```
$client = \Dapr\Client\DaprClient::clientBuilder()->build();
```

Using the Middleware
--------------------

[](#using-the-middleware)

The `App` object also implements a PSR-15 compatible middleware which implements the actor routes and subscribe routes for you.

```
$app = \Dapr\App::create(configure: [
    // custom configuration
]);
use_middleware($app);
```

Accessing Secrets
=================

[](#accessing-secrets)

You can access secrets easily:

```
