Dapr PHP SDK

    Dapr offers an SDK to help with the development of PHP applications. Using it, you can create PHP clients, servers, and virtual actors with Dapr.

    Optional Prerequisites

    Initialize your project

    Create a config.php, copying the contents below:

    Create your service

    1. <?php
    2. use Dapr\App;
    3. $app = App::create(configure: fn(\DI\ContainerBuilder $builder) => $builder->addDefinitions(__DIR__ . '/config.php'));
    4. return ['hello' => $name];
    5. });
    6. $app->start();

    Initialize dapr with dapr init and then start the project with .

    Congratulations, you’ve created your first Dapr service! I’m excited to see what you’ll do with it!

    More Information