Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.idea
app/**/rr
app/**/rr.exe
app/**/temporal-test-server
app/**/temporal-test-server.exe
app/**/temporal
app/**/temporal.exe
app/tests/**/*.log
app/runtime
app/vendor
65 changes: 33 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,49 @@ to start the application on host machine.

## Docker Compose setup
**1. Download the repository.**
```bash
$ git clone git@github.com:temporalio/samples-php.git
$ cd samples-php
```shell
git clone git@github.com:temporalio/samples-php.git
cd samples-php
```

**2. Build docker images.**
```bash
$ docker compose build
```shell
docker compose build
```

**3. Start server and application containers.**
```bash
$ docker compose up
```shell
docker compose up
```

**4. Run a sample**

To run a sample in docker use:

```bash
$ docker compose exec app php app.php {sample-name}
```shell
docker compose exec app php app.php {sample-name}
```

To observe active workers:

```bash
$ docker compose exec app rr workers -i
```shell
docker compose exec app rr workers -i
```

To run feature tests in docker use:

```bash
$ docker compose exec app composer test:feat
```shell
docker compose exec app composer test:feat
````

## Local Setup
**1. Make sure you have PHP 8.1, or higher, installed.**

**2. Clone this repo and change directory into the root of the project.**

```bash
$ git clone https://github.com/temporalio/samples-php
$ cd samples-php
```shell
git clone https://github.com/temporalio/samples-php
cd samples-php
```

**3. Install the gRPC PHP extension**
Expand All @@ -64,41 +64,42 @@ Follow the instructions here: [https://cloud.google.com/php/grpc](https://cloud.

Note: For Windows machines, you can download the `php_grpc.dll` from the [PECL website](https://pecl.php.net/package/gRPC)

Make sure you follow the all the steps to activate the gRPC extension in your `php.ini` file and install the protobuf runtime library in your project.
Make sure you follow all the steps to activate the gRPC extension in your `php.ini` file and install the protobuf runtime library in your project.

**4. Install additional PHP dependencies**

```bash
$ cd app
$ composer install
```shell
cd app
composer install
```

**5. Download RoadRunner application server**
**5. Download Temporal server and RoadRunner application server **

The Temporal PHP SDK requires the RoadRunner v2023.2 application server and supervisor to run Activities and Workflows in a scalable way.
The Temporal PHP SDK requires the RoadRunner application server and supervisor to run Activities and Workflows scalably.

```bash
$ cd app
$ ./vendor/bin/rr get
Run the following command to download the necessary binaries:

```shell
composer get:binaries
```

Note: You can install RoadRunner manually by downloading its binary from the [release page](https://github.com/spiral/roadrunner/releases/tag/v1.9.2).

**6. Run the Temporal Server**
Note: Check the [Quick install guide](https://docs.temporal.io/docs/server/quick-install) to install Temporal Server manually.

The Temporal Server must be up and running for the samples to work.
The fastest way to do that is by following the [Quick install guide](https://docs.temporal.io/docs/server/quick-install).
**6. Run the Temporal Server**

You can also run the included `docker-compose.yml` file. Make sure to comment `app` section.
```shell
./temporal server start-dev
```

**7. Start the application using RoadRunner**

By default, all samples run using a single RoadRunner Server instance.
To start the application using RoadRunner:

```bash
$ cd app
$ ./rr serve
```shell
./rr serve
```

You can now interact with the samples.
Expand Down
14 changes: 7 additions & 7 deletions app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"spiral/tokenizer": "^3.14.5",
"temporal/sdk": "^2.13",
"temporal/open-telemetry-interceptors": "dev-master",
"open-telemetry/exporter-otlp": "^1.1",
"spiral/tokenizer": "^3.16.0",
"temporal/sdk": "^2.16",
"temporal/open-telemetry-interceptors": "^1.0",
"open-telemetry/exporter-otlp": "^1.3",
"open-telemetry/transport-grpc": "^1.1",
"symfony/console": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"buggregator/trap": "^1.13",
"internal/dload": "^1.0",
"buggregator/trap": "^1.15",
"internal/dload": "^1.8.0",
"phpunit/phpunit": "^10.5"
},
"autoload": {
Expand All @@ -32,7 +32,7 @@
}
},
"scripts": {
"load:binaries": "dload",
"get:binaries": "dload get --no-interaction -vv",
"test:feat": "phpunit --testsuite=Feature --color=always --testdox"
}
}
Loading