PHP
Optional Prerequisites
- xdebug – for debugging
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:
<?php
use Dapr\App;
$app = App::create(configure: fn(\DI\ContainerBuilder $builder) => $builder->addDefinitions(__DIR__ . '/config.php'));
return ['hello' => $name];
});
$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.