PHP

    Optional Prerequisites

    Initialize your project

    In a directory where you want to create your service, run and answer the questions. Install dapr/php-sdk and any other dependencies you may wish to use.

    Create your service

    Create index.php and put the following contents:

    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();

    You can now open a web browser and point it to replacing world with your name, a pet’s name, or whatever you want.

    More Information