diff --git a/temporal/.editorconfig b/temporal/.editorconfig
new file mode 100644
index 000000000..5e9a93ea5
--- /dev/null
+++ b/temporal/.editorconfig
@@ -0,0 +1,17 @@
+# editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 4
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[*.yml]
+indent_size = 2
diff --git a/temporal/.gitattributes b/temporal/.gitattributes
new file mode 100644
index 000000000..2daf9d365
--- /dev/null
+++ b/temporal/.gitattributes
@@ -0,0 +1,27 @@
+# Autodetect text files
+* text=auto
+
+# ...Unless the name matches the following overriding patterns
+
+# Definitively text files
+*.php text
+*.css text
+*.js text
+*.txt text
+*.md text
+*.xml text
+*.json text
+*.bat text
+*.sql text
+*.yml text
+
+# Ensure those won't be messed up with
+*.png binary
+*.jpg binary
+*.gif binary
+*.ttf binary
+
+# Avoid merge conflicts in CHANGELOG
+# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/
+/CHANGELOG.md merge=union
+
diff --git a/temporal/.github/CODE_OF_CONDUCT.md b/temporal/.github/CODE_OF_CONDUCT.md
new file mode 100644
index 000000000..803e0007b
--- /dev/null
+++ b/temporal/.github/CODE_OF_CONDUCT.md
@@ -0,0 +1,67 @@
+# Yii Contributor Code of Conduct
+
+## Our Pledge
+
+As contributors and maintainers of this project, and in order to keep Yii community open and welcoming, we ask to respect all community members.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Personal attacks
+* Trolling or insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing other's private information, such as physical or electronic
+ addresses, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in
+ a professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in response
+to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments,
+commits, code, wiki edits, issues, and other contributions that are not aligned to this
+Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors
+that they deem inappropriate, threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces when
+an individual is representing the project or its community. Examples of representing
+a project or community include posting via an official social media account,
+within project GitHub, official forum or acting as an appointed representative at
+an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported
+by contacting core team members. All complaints will be reviewed and investigated
+and will result in a response that is deemed necessary and appropriate to the circumstances.
+The project team is obligated to maintain confidentiality with regard to the reporter of
+an incident. Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good faith
+may face temporary or permanent repercussions as determined by other members of
+the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage],
+version 1.4.0, available at
+[http://contributor-covenant.org/version/1/4/][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/temporal/.github/CONTRIBUTING.md b/temporal/.github/CONTRIBUTING.md
new file mode 100644
index 000000000..28737bdfa
--- /dev/null
+++ b/temporal/.github/CONTRIBUTING.md
@@ -0,0 +1,23 @@
+# Prerequisites
+
+- [Yii goal and values](https://github.com/yiisoft/docs/blob/master/001-yii-values.md)
+- [Namespaces](https://github.com/yiisoft/docs/blob/master/004-namespaces.md)
+- [Git commit messages](https://github.com/yiisoft/docs/blob/master/006-git-commit-messages.md)
+- [Exceptions](https://github.com/yiisoft/docs/blob/master/007-exceptions.md)
+- [Interfaces](https://github.com/yiisoft/docs/blob/master/008-interfaces.md)
+
+# Getting started
+
+Since Yii 3 consists of many packages, we have a [special development tool](https://github.com/yiisoft/docs/blob/master/005-development-tool.md).
+
+1. [Clone the repository](https://github.com/yiisoft/yii-dev-tool).
+
+2. [Set up your own fork](https://github.com/yiisoft/yii-dev-tool#using-your-own-fork).
+
+3. Now you are ready. Fork any package listed in `packages.php` and do `./yii-dev install username/package`.
+
+If you don't have any particular package in mind to start with:
+
+- [Check roadmap](https://github.com/yiisoft/docs/blob/master/003-roadmap.md).
+- Check package issues at github. Usually there are some.
+- Ask @samdark.
diff --git a/temporal/.github/FUNDING.yml b/temporal/.github/FUNDING.yml
new file mode 100644
index 000000000..f0dc5312d
--- /dev/null
+++ b/temporal/.github/FUNDING.yml
@@ -0,0 +1,4 @@
+# These are supported funding model platforms
+
+open_collective: yiisoft
+github: [yiisoft]
diff --git a/temporal/.github/ISSUE_TEMPLATE.md b/temporal/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 000000000..b748c2dac
--- /dev/null
+++ b/temporal/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,16 @@
+
+
+### What steps will reproduce the problem?
+
+### What is the expected result?
+
+### What do you get instead?
+
+
+### Additional info
+
+| Q | A
+| ---------------- | ---
+| Version | 1.0.?
+| PHP version |
+| Operating system |
diff --git a/temporal/.github/PULL_REQUEST_TEMPLATE.md b/temporal/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..4a3e8ace9
--- /dev/null
+++ b/temporal/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,6 @@
+| Q | A
+| ------------- | ---
+| Is bugfix? | ✔️/❌
+| New feature? | ✔️/❌
+| Breaks BC? | ✔️/❌
+| Fixed issues | comma-separated list of tickets # fixed by the PR, if any
diff --git a/temporal/.github/SECURITY.md b/temporal/.github/SECURITY.md
new file mode 100644
index 000000000..ba0931832
--- /dev/null
+++ b/temporal/.github/SECURITY.md
@@ -0,0 +1,6 @@
+# Security Policy
+
+Please use the [security issue form](https://www.yiiframework.com/security) to report to us any security issue you
+find in Yii. DO NOT use the issue tracker or discuss it in the public forum as it will cause more damage than help.
+
+Please note that as a non-commercial OpenSource project we are not able to pay bounties at the moment.
diff --git a/temporal/.github/dependabot.yml b/temporal/.github/dependabot.yml
new file mode 100644
index 000000000..d7ebdbfdb
--- /dev/null
+++ b/temporal/.github/dependabot.yml
@@ -0,0 +1,16 @@
+version: 2
+updates:
+ # Maintain dependencies for GitHub Actions.
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ # Too noisy. See https://github.community/t/increase-if-necessary-for-github-actions-in-dependabot/179581
+ open-pull-requests-limit: 0
+
+ # Maintain dependencies for Composer
+ - package-ecosystem: "composer"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ versioning-strategy: increase-if-necessary
diff --git a/temporal/.github/workflows/build.yml b/temporal/.github/workflows/build.yml
new file mode 100644
index 000000000..20e1a0341
--- /dev/null
+++ b/temporal/.github/workflows/build.yml
@@ -0,0 +1,63 @@
+on:
+ - pull_request
+ - push
+
+name: build
+
+jobs:
+ tests:
+ name: PHP ${{ matrix.php }}-${{ matrix.os }}
+
+ env:
+ extensions: fileinfo, pdo, pdo_sqlite
+ key: cache-v1
+
+ runs-on: ${{ matrix.os }}
+
+ strategy:
+ matrix:
+ os:
+ - ubuntu-latest
+ - windows-latest
+
+ php:
+ - "8.0"
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Install PHP with extensions
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ extensions: ${{ env.extensions }}
+ ini-values: date.timezone='UTC'
+ coverage: pcov
+ tools: composer:v2
+
+ - name: Determine composer cache directory on Linux
+ if: matrix.os == 'ubuntu-latest'
+ run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
+
+ - name: Determine composer cache directory on Windows
+ if: matrix.os == 'windows-latest'
+ run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+
+ - name: Cache dependencies installed with composer
+ uses: actions/cache@v2
+ with:
+ path: ${{ env.COMPOSER_CACHE_DIR }}
+ key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
+ restore-keys: |
+ php${{ matrix.php }}-composer-
+
+ - name: Update composer
+ run: composer self-update
+
+ - name: Install dependencies with composer
+ run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
+
+ - name: Run tests with codeception
+ run: |
+ php -S 127.0.0.1:8080 -t public public/index-test.php > ./runtime/yii.log 2>&1 & vendor/bin/codecept run acceptance --env github-ci
diff --git a/temporal/.github/workflows/static.yml b/temporal/.github/workflows/static.yml
new file mode 100644
index 000000000..6d2ee4b09
--- /dev/null
+++ b/temporal/.github/workflows/static.yml
@@ -0,0 +1,50 @@
+on:
+ - pull_request
+ - push
+
+name: static analysis
+
+jobs:
+ mutation:
+ name: PHP ${{ matrix.php }}-${{ matrix.os }}
+
+ runs-on: ${{ matrix.os }}
+
+ strategy:
+ matrix:
+ os:
+ - ubuntu-latest
+
+ php:
+ - "8.0"
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: "${{ matrix.php }}"
+ tools: composer:v2, cs2pr
+ coverage: none
+
+ - name: Determine composer cache directory
+ run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
+
+ - name: Cache dependencies installed with composer
+ uses: actions/cache@v2
+ with:
+ path: ${{ env.COMPOSER_CACHE_DIR }}
+ key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
+ restore-keys: |
+ php${{ matrix.php }}-composer-
+
+ - name: Update composer
+ run: composer self-update
+
+ - name: Install dependencies with composer
+ run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
+
+ - name: Static analysis
+ run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle | cs2pr --graceful-warnings --colorize
diff --git a/temporal/.gitignore b/temporal/.gitignore
new file mode 100644
index 000000000..15fee4e28
--- /dev/null
+++ b/temporal/.gitignore
@@ -0,0 +1,40 @@
+# phpstorm project files
+.idea
+
+# netbeans project files
+nbproject
+
+# zend studio for eclipse project files
+.buildpath
+.project
+.settings
+
+# windows thumbnail cache
+Thumbs.db
+
+# composer vendor dir
+/vendor
+
+/composer.lock
+
+# composer itself is not needed
+composer.phar
+
+# Mac DS_Store Files
+.DS_Store
+
+# phpunit itself is not needed
+phpunit.phar
+# local phpunit config
+/phpunit.xml
+# phpunit cache
+.phpunit.result.cache
+
+# Codeception
+c3.php
+
+#tests
+tests/_data/database.db_snapshot
+
+.env
+rr
diff --git a/temporal/.phpunit-watcher.yml b/temporal/.phpunit-watcher.yml
new file mode 100644
index 000000000..0e4d76634
--- /dev/null
+++ b/temporal/.phpunit-watcher.yml
@@ -0,0 +1,11 @@
+watch:
+ directories:
+ - src
+ - tests
+ fileMask: '*.php'
+notifications:
+ passingTests: false
+ failingTests: false
+phpunit:
+ binaryPath: vendor/bin/phpunit
+ timeout: 180
diff --git a/temporal/.rr.yaml b/temporal/.rr.yaml
new file mode 100644
index 000000000..2cc5076fd
--- /dev/null
+++ b/temporal/.rr.yaml
@@ -0,0 +1,47 @@
+# Rich config example you may look at here
+# https://github.com/roadrunner-server/roadrunner/blob/master/.rr.yaml
+
+rpc:
+ listen: tcp://0.0.0.0:6001
+
+server:
+ command: "php -dxdebug.mode=debug public/index.php"
+ # command: "php public/index.php"
+
+http:
+ address: 0.0.0.0:8080
+ middleware: [ "static", "gzip" ]
+ pool:
+ num_workers: 2
+ uploads:
+ forbid: [ ".php", ".exe", ".bat" ]
+ static:
+ dir: "public"
+ forbid: [ ".php", ".htaccess" ]
+
+temporal:
+ address: 0.0.0.0:7233
+ activities:
+ num_workers: 5
+
+logs:
+ mode: development
+ channels:
+ http:
+ level: debug # Log all http requests, set to info to disable
+ server:
+ level: info # Everything written to worker stderr is logged
+ mode: raw
+ metrics:
+ level: debug
+ temporal:
+ level: info
+
+reload:
+ enabled: true
+ interval: 1s
+ patterns: [".php", ".yaml"]
+ services:
+ http:
+ dirs: ["."]
+ recursive: true
diff --git a/temporal/.scrutinizer.yml b/temporal/.scrutinizer.yml
new file mode 100644
index 000000000..b53476e64
--- /dev/null
+++ b/temporal/.scrutinizer.yml
@@ -0,0 +1,38 @@
+checks:
+ php: true
+
+filter:
+ paths:
+ - "src/*"
+ excluded_paths:
+ - "src/ApplicationRunner.php"
+
+build:
+ nodes:
+ analysis:
+ environment:
+ php: 8.0.6
+
+ tests:
+ override:
+ - php-scrutinizer-run
+
+ tests-and-coverage:
+ environment:
+ php:
+ version: 8.0.6
+ ini:
+ xdebug.mode: coverage
+
+ dependencies:
+ override:
+ - composer self-update
+ - composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
+
+ tests:
+ override:
+ - command: php -S 127.0.0.1:8080 -t public public/index-test.php > ./runtime/yii.log 2>&1 & vendor/bin/codecept run acceptance --coverage-xml --env github-ci
+ on_node: 1
+ coverage:
+ file: tests/_output/coverage.xml
+ format: php-clover
diff --git a/temporal/.styleci.yml b/temporal/.styleci.yml
new file mode 100644
index 000000000..81b065005
--- /dev/null
+++ b/temporal/.styleci.yml
@@ -0,0 +1,89 @@
+preset: psr12
+risky: true
+
+version: 8
+
+finder:
+ exclude:
+ - docs
+ - vendor
+ - resources
+ - views
+ - public
+ - templates
+ not-name:
+ - UnionCar.php
+ - TimerUnionTypes.php
+ - schema1.php
+
+enabled:
+ - alpha_ordered_traits
+ - array_indentation
+ - array_push
+ - combine_consecutive_issets
+ - combine_consecutive_unsets
+ - combine_nested_dirname
+ - declare_strict_types
+ - dir_constant
+ - final_static_access
+ - fully_qualified_strict_types
+ - function_to_constant
+ - hash_to_slash_comment
+ - is_null
+ - logical_operators
+ - magic_constant_casing
+ - magic_method_casing
+ - method_separation
+ - modernize_types_casting
+ - native_function_casing
+ - native_function_type_declaration_casing
+ - no_alias_functions
+ - no_empty_comment
+ - no_empty_phpdoc
+ - no_empty_statement
+ - no_extra_block_blank_lines
+ - no_short_bool_cast
+ - no_superfluous_elseif
+ - no_unneeded_control_parentheses
+ - no_unneeded_curly_braces
+ - no_unneeded_final_method
+ - no_unset_cast
+ - no_unused_imports
+ - no_unused_lambda_imports
+ - no_useless_else
+ - no_useless_return
+ - normalize_index_brace
+ - php_unit_dedicate_assert
+ - php_unit_dedicate_assert_internal_type
+ - php_unit_expectation
+ - php_unit_mock
+ - php_unit_mock_short_will_return
+ - php_unit_namespaced
+ - php_unit_no_expectation_annotation
+ - phpdoc_no_empty_return
+ - phpdoc_no_useless_inheritdoc
+ - phpdoc_order
+ - phpdoc_property
+ - phpdoc_scalar
+ - phpdoc_separation
+ - phpdoc_singular_inheritdoc
+ - phpdoc_trim
+ - phpdoc_trim_consecutive_blank_line_separation
+ - phpdoc_type_to_var
+ - phpdoc_types
+ - phpdoc_types_order
+ - print_to_echo
+ - regular_callable_call
+ - return_assignment
+ - self_accessor
+ - self_static_accessor
+ - set_type_to_cast
+ - short_array_syntax
+ - short_list_syntax
+ - simplified_if_return
+ - single_quote
+ - standardize_not_equals
+ - ternary_to_null_coalescing
+ - trailing_comma_in_multiline_array
+ - unalign_double_arrow
+ - unalign_equals
diff --git a/temporal/CHANGELOG.md b/temporal/CHANGELOG.md
new file mode 100644
index 000000000..6a8fbfeca
--- /dev/null
+++ b/temporal/CHANGELOG.md
@@ -0,0 +1,5 @@
+# _____ Change Log
+
+## 1.0.0 under development
+
+- Initial release.
diff --git a/temporal/LICENSE.md b/temporal/LICENSE.md
new file mode 100644
index 000000000..bc5674fe4
--- /dev/null
+++ b/temporal/LICENSE.md
@@ -0,0 +1,29 @@
+Copyright © 2008 by Yii Software (https://www.yiiframework.com/)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Yii Software nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/temporal/README.md b/temporal/README.md
new file mode 100644
index 000000000..fc3d58aa2
--- /dev/null
+++ b/temporal/README.md
@@ -0,0 +1,92 @@
+# Introduction
+
+This is demo application to show how to work with [Temporal](https://github.com/temporalio/sdk-php) from Yii 3 application.
+
+## Installation
+Install PHP dependencies:
+
+```shell
+composer i --prefer-dist
+```
+
+Get `RoadRunner` binary:
+
+```shell
+./vendor/bin/rr get-binary
+```
+
+Run docker containers:
+
+```shell
+docker-compose up -d
+```
+
+Run `RoadRunner`:
+
+```shell
+./rr serve -d
+```
+
+## Usage
+
+Now you can open [http://localhost:8080](http://localhost:8080/)
+and see small description about examples:
+
+```
+This project is example how to use Temporal with Yii 3 application.
+There are exist several examples how it works.
+Examples:
+If you want to see how "simple" workflow works click here.
+There is usual call non-blocking action. It should work as faster as you can run usual php code.
+If you want to see how "complicated" workflow works click here.
+There are imitation for blocking action. Different methods calls will run with random delay: from 1 to 5 seconds per call.
+If you want to see how "deferred" workflow works click here.
+There are imitation for asynchronous action. You will get "job id" and you can track the status in another endpoint.
+Logic for workflow will be same as "complicated" workflow.
+```
+
+Also, you can open Temporal admin panel the located in [http://localhost:8088](http://localhost:8088/)
+
+---
+
+To add more **workflows** and **activities** you need to configure them in [config/common/temporal.php](config/common/temporal.php):
+You should add tag `temporal.workflow` for each new workflow and `temporal.activity` for each new activity.
+
+Example:
+```php
+\App\Temporal\Workflow\LongWorkflow::class => [
+ 'class' => \App\Temporal\Workflow\LongWorkflow::class,
+ 'tags' => ['temporal.workflow']
+],
+
+\App\Temporal\Activity\CommonActivity::class => [
+ 'class' => \App\Temporal\Activity\CommonActivity::class,
+ 'tags' => ['temporal.activity']
+],
+```
+
+After that the workflows and activities will be automatically registered in [src/ApplicationRunner.php](src/ApplicationRunner.php)
+
+## Contribution
+
+You are welcome to add more examples, fix bugs or orthographic errors.
+
+## Useful links
+
+#### Used libraries
+[Temporal PHP SDK](https://github.com/temporalio/sdk-php)
+[RoadRunner](https://github.com/spiral/roadrunner)
+
+#### Temporal:
+[Temporal (temporal.io)](https://temporal.io/)
+
+#### Workshops
+1st part [Оркестрируй это! Описываем сложные бизнес процессы на PHP - Антон Титов](https://www.youtube.com/watch?v=0NCMEaFMj_M)
+
+2nd part [Оркестрация и закон Мерфи: обрабатываем ошибки-бизнес процессов](https://www.youtube.com/watch?v=upL8o-OXYEc)
+
+#### Application (after run on local machine)
+[This application demo](http://localhost:8080/)
+
+[Temporal admin panel](http://localhost:8088/)
+
diff --git a/temporal/autoload.php b/temporal/autoload.php
new file mode 100644
index 000000000..2e5eee2a3
--- /dev/null
+++ b/temporal/autoload.php
@@ -0,0 +1,20 @@
+load();
+
+$_ENV['YII_ENV'] = empty($_ENV['YII_ENV']) ? null : (string)$_ENV['YII_ENV'];
+$_SERVER['YII_ENV'] = $_ENV['YII_ENV'];
+
+$_ENV['YII_DEBUG'] = filter_var(
+ !empty($_ENV['YII_DEBUG']) ? $_ENV['YII_DEBUG'] : true,
+ FILTER_VALIDATE_BOOLEAN,
+ FILTER_NULL_ON_FAILURE
+) ?? true;
+$_SERVER['YII_DEBUG'] = $_ENV['YII_DEBUG'];
diff --git a/temporal/codeception.yml b/temporal/codeception.yml
new file mode 100644
index 000000000..78b2e645c
--- /dev/null
+++ b/temporal/codeception.yml
@@ -0,0 +1,17 @@
+namespace: App\Tests
+paths:
+ tests: tests
+ output: tests/_output
+ data: tests/_data
+ support: tests/_support
+ envs: tests/_envs
+actor_suffix: Tester
+extensions:
+ enabled:
+ - Codeception\Extension\RunFailed
+coverage:
+ enabled: true
+ c3_url: http://127.0.0.1:8080
+ whitelist:
+ include:
+ - src/*
diff --git a/temporal/composer.json b/temporal/composer.json
new file mode 100644
index 000000000..a8cf073e5
--- /dev/null
+++ b/temporal/composer.json
@@ -0,0 +1,183 @@
+{
+ "name": "yiisoft/app-api",
+ "type": "project",
+ "description": "Yii Framework API project template",
+ "keywords": [
+ "yii3",
+ "app",
+ "api",
+ "rest"
+ ],
+ "homepage": "https://github.com/yiisoft/app-api/",
+ "license": "BSD-3-Clause",
+ "support": {
+ "issues": "https://github.com/yiisoft/app-api/issues?state=open",
+ "forum": "https://www.yiiframework.com/forum/",
+ "wiki": "https://www.yiiframework.com/wiki/",
+ "irc": "irc://irc.freenode.net/yii",
+ "source": "https://github.com/yiisoft/app-api"
+ },
+ "minimum-stability": "dev",
+ "prefer-stable": true,
+ "require": {
+ "php": "^8.0",
+ "cebe/markdown": "^1.2",
+ "cycle/orm": "^v2.2",
+ "httpsoft/http-message": "^1.0",
+ "psr/container": "^2.0",
+ "psr/http-factory": "^1.0",
+ "psr/http-message": "^1.0",
+ "psr/http-server-handler": "^1.0",
+ "psr/http-server-middleware": "^1.0",
+ "psr/log": "^3.0",
+ "spiral/roadrunner": "^v2.11",
+ "temporal/sdk": "^2.3",
+ "vlucas/phpdotenv": "^v5.5",
+ "yiisoft/access": "^1.0",
+ "yiisoft/aliases": "^2.0",
+ "yiisoft/auth": "^3.0",
+ "yiisoft/cache": "^2.0",
+ "yiisoft/cache-file": "^2.0",
+ "yiisoft/classifier": "dev-master",
+ "yiisoft/config": "^1.1",
+ "yiisoft/data": "dev-master",
+ "yiisoft/data-response": "^1.0",
+ "yiisoft/definitions": "^2.0",
+ "yiisoft/di": "^1.1",
+ "yiisoft/error-handler": "^2.1",
+ "yiisoft/factory": "^1.0",
+ "yiisoft/files": "^2.0",
+ "yiisoft/http": "^1.2",
+ "yiisoft/injector": "^1.1",
+ "yiisoft/log": "^2.0",
+ "yiisoft/log-target-file": "^2.0",
+ "yiisoft/request-body-parser": "^1.1",
+ "yiisoft/request-model": "dev-master",
+ "yiisoft/router": "^1.2",
+ "yiisoft/router-fastroute": "^1.1",
+ "yiisoft/security": "^1.0",
+ "yiisoft/user": "^1.0",
+ "yiisoft/validator": "dev-master",
+ "yiisoft/yii-console": "^1.3",
+ "yiisoft/yii-cycle": "dev-master",
+ "yiisoft/yii-event": "^1.0",
+ "yiisoft/yii-http": "^1.0",
+ "yiisoft/yii-middleware": "dev-master",
+ "yiisoft/yii-runner-console": "^1.1",
+ "yiisoft/yii-runner-roadrunner": "dev-support-temporal",
+ "yiisoft/yii-swagger": "^1.2"
+ },
+ "require-dev": {
+ "codeception/c3": "^2.6.0",
+ "codeception/codeception": "^5.0",
+ "codeception/lib-innerbrowser": "^3.1",
+ "codeception/module-asserts": "^3.0",
+ "codeception/module-db": "^3.0",
+ "codeception/module-phpbrowser": "^3.0",
+ "codeception/module-rest": "^3.3",
+ "phpunit/phpunit": "^9.5",
+ "roave/infection-static-analysis-plugin": "^1.25",
+ "spatie/phpunit-watcher": "^1.23",
+ "vimeo/psalm": "^4.29",
+ "yiisoft/json": "^1.0",
+ "yiisoft/yii-debug": "3.0.x-dev",
+ "yiisoft/yii-debug-api": "3.0.x-dev"
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "src"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "App\\Tests\\": "tests/",
+ "App\\Tests\\Acceptance\\": "tests/acceptance/",
+ "App\\Tests\\Functional\\": "tests/functional/"
+ }
+ },
+ "scripts": {
+ "serve": "./yii serve",
+ "post-update-cmd": [
+ "App\\Installer::postUpdate"
+ ],
+ "test": "phpunit --testdox --no-interaction",
+ "test-watch": "phpunit-watcher watch"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ },
+ "config-plugin-options": {
+ "source-directory": "config"
+ },
+ "config-plugin": {
+ "common": "common/*.php",
+ "params": [
+ "params.php",
+ "?params-local.php"
+ ],
+ "web": [
+ "$common",
+ "web/*.php"
+ ],
+ "console": [
+ "$common",
+ "console/*.php"
+ ],
+ "events": "events.php",
+ "events-web": [
+ "$events",
+ "events-web.php"
+ ],
+ "events-console": [
+ "$events",
+ "events-console.php"
+ ],
+ "providers": "providers.php",
+ "providers-web": [
+ "$providers",
+ "providers-web.php"
+ ],
+ "providers-console": [
+ "$providers",
+ "providers-console.php"
+ ],
+ "delegates": "delegates.php",
+ "delegates-web": [
+ "$delegates",
+ "delegates-web.php"
+ ],
+ "delegates-console": [
+ "$delegates",
+ "delegates-console.php"
+ ],
+ "routes": "routes.php",
+ "bootstrap": "bootstrap.php",
+ "bootstrap-web": [
+ "$bootstrap",
+ "bootstrap-web.php"
+ ],
+ "bootstrap-console": [
+ "$bootstrap",
+ "bootstrap-console.php"
+ ],
+ "tags": "tags.php",
+ "tags-web": [
+ "$tags",
+ "tags-web.php"
+ ],
+ "tags-console": [
+ "$tags",
+ "tags-console.php"
+ ]
+ }
+ },
+ "config": {
+ "sort-packages": true,
+ "allow-plugins": {
+ "codeception/c3": true,
+ "infection/extension-installer": true,
+ "yiisoft/config": true
+ }
+ }
+}
diff --git a/temporal/config/.gitignore b/temporal/config/.gitignore
new file mode 100644
index 000000000..8268b94c1
--- /dev/null
+++ b/temporal/config/.gitignore
@@ -0,0 +1 @@
+*-local.php
diff --git a/temporal/config/.merge-plan.php b/temporal/config/.merge-plan.php
new file mode 100644
index 000000000..9693c6632
--- /dev/null
+++ b/temporal/config/.merge-plan.php
@@ -0,0 +1,337 @@
+ [
+ 'common' => [
+ 'yiisoft/cache-file' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/router-fastroute' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/yii-cycle' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/yii-runner-roadrunner' => [
+ 'config/common/temporal.php',
+ ],
+ 'yiisoft/validator' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/router' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/yii-debug' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/profiler' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/yii-filesystem' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/yii-queue' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/aliases' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/log-target-file' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/translator' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/yii-event' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/view' => [
+ 'config/common.php',
+ ],
+ 'yiisoft/cache' => [
+ 'config/common.php',
+ ],
+ '/' => [
+ 'common/*.php',
+ ],
+ ],
+ 'params' => [
+ 'yiisoft/cache-file' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/router-fastroute' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/user' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/yii-cycle' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/yii-runner-roadrunner' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/yii-swagger' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/yii-debug-api' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/validator' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/assets' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/yii-view' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/yii-debug' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/profiler' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/yii-queue' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/aliases' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/data-response' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/log-target-file' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/translator' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/yii-console' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/csrf' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/view' => [
+ 'config/params.php',
+ ],
+ 'yiisoft/session' => [
+ 'config/params.php',
+ ],
+ '/' => [
+ 'params.php',
+ '?params-local.php',
+ ],
+ ],
+ 'web' => [
+ 'yiisoft/router-fastroute' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/user' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/yii-swagger' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/yii-debug-api' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/middleware-dispatcher' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/assets' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/yii-view' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/yii-debug' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/data-response' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/error-handler' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/yii-event' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/csrf' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/view' => [
+ 'config/web.php',
+ ],
+ 'yiisoft/session' => [
+ 'config/web.php',
+ ],
+ '/' => [
+ '$common',
+ 'web/*.php',
+ ],
+ ],
+ 'console' => [
+ 'yiisoft/yii-cycle' => [
+ 'config/console.php',
+ ],
+ 'yiisoft/yii-debug' => [
+ 'config/console.php',
+ ],
+ 'yiisoft/yii-console' => [
+ 'config/console.php',
+ ],
+ 'yiisoft/yii-event' => [
+ 'config/console.php',
+ ],
+ '/' => [
+ '$common',
+ 'console/*.php',
+ ],
+ ],
+ 'events-console' => [
+ 'yiisoft/yii-cycle' => [
+ 'config/events-console.php',
+ ],
+ 'yiisoft/yii-debug' => [
+ 'config/events-console.php',
+ ],
+ 'yiisoft/log' => [
+ 'config/events-console.php',
+ ],
+ 'yiisoft/yii-console' => [
+ 'config/events-console.php',
+ ],
+ 'yiisoft/yii-event' => [
+ '$events',
+ 'config/events-console.php',
+ ],
+ '/' => [
+ '$events',
+ 'events-console.php',
+ ],
+ ],
+ 'delegates' => [
+ 'yiisoft/yii-cycle' => [
+ 'config/delegates.php',
+ ],
+ '/' => [
+ 'delegates.php',
+ ],
+ ],
+ 'bootstrap-web' => [
+ 'yiisoft/yii-debug-api' => [
+ 'config/bootstrap-web.php',
+ ],
+ '/' => [
+ '$bootstrap',
+ 'bootstrap-web.php',
+ ],
+ ],
+ 'routes' => [
+ 'yiisoft/yii-debug-api' => [
+ 'config/routes.php',
+ ],
+ '/' => [
+ 'routes.php',
+ ],
+ ],
+ 'providers-web' => [
+ 'yiisoft/yii-debug-api' => [
+ 'config/providers-web.php',
+ ],
+ '/' => [
+ '$providers',
+ 'providers-web.php',
+ ],
+ ],
+ 'providers' => [
+ 'yiisoft/yii-debug' => [
+ 'config/providers.php',
+ ],
+ '/' => [
+ 'providers.php',
+ ],
+ ],
+ 'events-web' => [
+ 'yiisoft/yii-debug' => [
+ 'config/events-web.php',
+ ],
+ 'yiisoft/profiler' => [
+ 'config/events-web.php',
+ ],
+ 'yiisoft/log' => [
+ 'config/events-web.php',
+ ],
+ 'yiisoft/yii-event' => [
+ '$events',
+ 'config/events-web.php',
+ ],
+ '/' => [
+ '$events',
+ 'events-web.php',
+ ],
+ ],
+ 'providers-console' => [
+ 'yiisoft/yii-console' => [
+ 'config/providers-console.php',
+ ],
+ '/' => [
+ '$providers',
+ 'providers-console.php',
+ ],
+ ],
+ 'events' => [
+ 'yiisoft/yii-event' => [
+ 'config/events.php',
+ ],
+ '/' => [
+ 'events.php',
+ ],
+ ],
+ 'delegates-web' => [
+ '/' => [
+ '$delegates',
+ 'delegates-web.php',
+ ],
+ ],
+ 'delegates-console' => [
+ '/' => [
+ '$delegates',
+ 'delegates-console.php',
+ ],
+ ],
+ 'bootstrap' => [
+ '/' => [
+ 'bootstrap.php',
+ ],
+ ],
+ 'bootstrap-console' => [
+ '/' => [
+ '$bootstrap',
+ 'bootstrap-console.php',
+ ],
+ ],
+ 'tags' => [
+ '/' => [
+ 'tags.php',
+ ],
+ ],
+ 'tags-web' => [
+ '/' => [
+ '$tags',
+ 'tags-web.php',
+ ],
+ ],
+ 'tags-console' => [
+ '/' => [
+ '$tags',
+ 'tags-console.php',
+ ],
+ ],
+ ],
+];
diff --git a/temporal/config/bootstrap-console.php b/temporal/config/bootstrap-console.php
new file mode 100644
index 000000000..0dae23dee
--- /dev/null
+++ b/temporal/config/bootstrap-console.php
@@ -0,0 +1,5 @@
+ IdMessageReader::class,
+ \Yiisoft\Cache\CacheInterface::class => \Yiisoft\Cache\Cache::class,
+ \Psr\SimpleCache\CacheInterface::class => \Yiisoft\Cache\File\FileCache::class,
+];
diff --git a/temporal/config/common/logger.php b/temporal/config/common/logger.php
new file mode 100644
index 000000000..b49b94ba0
--- /dev/null
+++ b/temporal/config/common/logger.php
@@ -0,0 +1,21 @@
+ [
+ 'class' => Logger::class,
+ '__construct()' => [
+ 'targets' => ReferencesArray::from([
+ FileTarget::class,
+ ]),
+ ],
+ ],
+];
diff --git a/temporal/config/common/psr17.php b/temporal/config/common/psr17.php
new file mode 100644
index 000000000..9787bb293
--- /dev/null
+++ b/temporal/config/common/psr17.php
@@ -0,0 +1,25 @@
+ RequestFactory::class,
+ ServerRequestFactoryInterface::class => ServerRequestFactory::class,
+ ResponseFactoryInterface::class => ResponseFactory::class,
+ StreamFactoryInterface::class => StreamFactory::class,
+ UriFactoryInterface::class => UriFactory::class,
+ UploadedFileFactoryInterface::class => UploadedFileFactory::class,
+];
diff --git a/temporal/config/common/router.php b/temporal/config/common/router.php
new file mode 100644
index 000000000..64b970033
--- /dev/null
+++ b/temporal/config/common/router.php
@@ -0,0 +1,26 @@
+ static function (RouteCollectorInterface $collector) use ($config) {
+ $collector
+ ->middleware(FormatDataResponse::class)
+ ->middleware(ExceptionMiddleware::class)
+ ->middleware(RequestBodyParser::class)
+ ->addGroup(Group::create()->routes(...$config->get('routes')));
+
+ return new RouteCollection($collector);
+ },
+];
diff --git a/temporal/config/common/temporal.php b/temporal/config/common/temporal.php
new file mode 100644
index 000000000..93ecbfcf6
--- /dev/null
+++ b/temporal/config/common/temporal.php
@@ -0,0 +1,11 @@
+ WorkflowClient::create(ServiceClient::create('localhost:7233')),
+];
diff --git a/temporal/config/console/.gitkeep b/temporal/config/console/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/temporal/config/delegates-console.php b/temporal/config/delegates-console.php
new file mode 100644
index 000000000..0dae23dee
--- /dev/null
+++ b/temporal/config/delegates-console.php
@@ -0,0 +1,5 @@
+ 'support@example.com',
+ 'middlewares' => [
+ ErrorCatcher::class,
+ SubFolder::class,
+ Router::class,
+ ],
+
+ 'yiisoft/aliases' => [
+ 'aliases' => [
+ '@root' => dirname(__DIR__),
+ '@assets' => '@public/assets',
+ '@assetsUrl' => '@baseUrl/assets',
+ '@baseUrl' => '/',
+ '@data' => '@root/data',
+ '@public' => '@root/public',
+ '@resources' => '@root/resources',
+ '@runtime' => '@root/runtime',
+ '@src' => '@root/src',
+ '@tests' => '@root/tests',
+ '@views' => '@root/views',
+ '@vendor' => '@root/vendor',
+ ],
+ ],
+
+ 'yiisoft/router-fastroute' => [
+ 'enableCache' => false,
+ ],
+
+ // Console commands
+ 'yiisoft/yii-console' => [
+ 'commands' => [
+ 'cycle/schema' => Schema\SchemaCommand::class,
+ 'cycle/schema/php' => Schema\SchemaPhpCommand::class,
+ 'cycle/schema/clear' => Schema\SchemaClearCommand::class,
+ 'cycle/schema/rebuild' => Schema\SchemaRebuildCommand::class,
+ 'migrate/create' => Migration\CreateCommand::class,
+ 'migrate/generate' => Migration\GenerateCommand::class,
+ 'migrate/up' => Migration\UpCommand::class,
+ 'migrate/down' => Migration\DownCommand::class,
+ 'migrate/list' => Migration\ListCommand::class,
+ ],
+ ],
+
+ 'yiisoft/yii-cycle' => [
+ // DBAL config
+ 'dbal' => [
+ // SQL query logger. Definition of Psr\Log\LoggerInterface
+ 'query-logger' => null,
+ // Default database
+ 'default' => 'default',
+ 'aliases' => [],
+ 'databases' => [
+ 'default' => ['connection' => 'sqlite'],
+ ],
+ 'connections' => [
+ 'sqlite' => [
+ 'driver' => SQLiteDriver::class,
+ 'connection' => $_ENV['YII_ENV'] === 'production'
+ ? 'sqlite:@data/db/database.db'
+ : 'sqlite:@tests/_data/database.db',
+ 'username' => '',
+ 'password' => '',
+ ],
+ ],
+ ],
+
+ // Cycle migration config
+ 'migrations' => [
+ 'directory' => '@root/migrations',
+ 'namespace' => 'App\\Migration',
+ 'table' => 'migration',
+ 'safe' => false,
+ ],
+
+ /**
+ * SchemaProvider list for {@see \Yiisoft\Yii\Cycle\Schema\Provider\Support\SchemaProviderPipeline}
+ * Array of classname and {@see SchemaProviderInterface} object.
+ * You can configure providers if you pass classname as key and parameters as array:
+ * [
+ * SimpleCacheSchemaProvider::class => [
+ * 'key' => 'my-custom-cache-key'
+ * ],
+ * FromFilesSchemaProvider::class => [
+ * 'files' => ['@runtime/cycle-schema.php']
+ * ],
+ * FromConveyorSchemaProvider::class => [
+ * 'generators' => [
+ * Generator\SyncTables::class, // sync table changes to database
+ * ]
+ * ],
+ * ]
+ */
+ 'schema-providers' => [
+ // Uncomment next line to enable schema cache
+ // SimpleCacheSchemaProvider::class => ['key' => 'cycle-orm-cache-key'],
+ FromConveyorSchemaProvider::class => [
+ 'generators' => [
+ Generator\SyncTables::class,
+ ],
+ ],
+ ],
+
+ /**
+ * Config for {@see \Yiisoft\Yii\Cycle\Schema\Conveyor\AnnotatedSchemaConveyor}
+ * Annotated entity directories list.
+ * {@see \Yiisoft\Aliases\Aliases} are also supported.
+ */
+ 'annotated-entity-paths' => [
+ '@src',
+ ],
+ ],
+ 'yiisoft/yii-swagger' => [
+ 'annotation-paths' => [
+ '@src',
+ ],
+ ],
+
+ 'yiisoft/yii-runner-roadrunner' => [
+ 'temporal' => [
+ 'enabled' => true,
+ ],
+ ],
+];
diff --git a/temporal/config/providers-console.php b/temporal/config/providers-console.php
new file mode 100644
index 000000000..0dae23dee
--- /dev/null
+++ b/temporal/config/providers-console.php
@@ -0,0 +1,5 @@
+action([\App\Controller\HomeController::class, 'index'])
+ ->name('home'),
+
+ Route::get('/simple/{name:\w+}')
+ ->action([\App\Controller\WorkflowController::class, 'simpleAction'])
+ ->name('temporal/simple'),
+
+ Route::get('/complicated/{name:\w+}')
+ ->action([\App\Controller\WorkflowController::class, 'complicatedAction'])
+ ->name('temporal/complicated'),
+
+ Route::get('/asynchronous/{name:\w+}')
+ ->action([\App\Controller\WorkflowController::class, 'asynchronousAction'])
+ ->name('temporal/asynchronous'),
+
+ Route::get('/asynchronous-status/{id:[\w-]+}')
+ ->action([\App\Controller\WorkflowController::class, 'asynchronousStatusAction'])
+ ->name('temporal/asynchronous-status'),
+
+ // Swagger routes
+ Group::create('/docs')
+ ->routes(
+ Route::get('')
+ ->middleware(FormatDataResponseAsHtml::class)
+ ->action(fn (SwaggerUi $swaggerUi) => $swaggerUi->withJsonUrl('/docs/openapi.json')),
+ Route::get('/openapi.json')
+ ->middleware(FormatDataResponseAsJson::class)
+ ->action(SwaggerJson::class),
+ ),
+];
diff --git a/temporal/config/tags-console.php b/temporal/config/tags-console.php
new file mode 100644
index 000000000..1f6a841dc
--- /dev/null
+++ b/temporal/config/tags-console.php
@@ -0,0 +1,6 @@
+ [
+ ...iterator_to_array($classifier->withAttribute(WorkflowInterface::class)->find()),
+ ],
+ 'temporal.activity' => [
+ ...iterator_to_array($classifier->withAttribute(ActivityInterface::class)->find()),
+ ],
+];
diff --git a/temporal/config/temporal/development-sql.yaml b/temporal/config/temporal/development-sql.yaml
new file mode 100644
index 000000000..26c3b63c2
--- /dev/null
+++ b/temporal/config/temporal/development-sql.yaml
@@ -0,0 +1,6 @@
+limit.maxIDLength:
+ - value: 255
+ constraints: {}
+system.forceSearchAttributesCacheRefreshOnRead:
+ - value: true # Dev setup only. Please don't turn this on in production.
+ constraints: {}
diff --git a/temporal/config/web/application.php b/temporal/config/web/application.php
new file mode 100644
index 000000000..9fafee9ca
--- /dev/null
+++ b/temporal/config/web/application.php
@@ -0,0 +1,23 @@
+ [
+ '__construct()' => [
+ 'dispatcher' => DynamicReference::to(static function (Injector $injector) use ($params) {
+ return $injector->make(MiddlewareDispatcher::class)
+ ->withMiddlewares($params['middlewares']);
+ }),
+ 'fallbackHandler' => Reference::to(NotFoundHandler::class),
+ ],
+ ],
+];
diff --git a/temporal/config/web/data-response.php b/temporal/config/web/data-response.php
new file mode 100644
index 000000000..336029d79
--- /dev/null
+++ b/temporal/config/web/data-response.php
@@ -0,0 +1,28 @@
+ ApiResponseFormatter::class,
+ DataResponseFactoryInterface::class => DataResponseFactory::class,
+ ContentNegotiator::class => [
+ '__construct()' => [
+ 'contentFormatters' => [
+ 'text/html' => new HtmlDataResponseFormatter(),
+ 'application/xml' => new XmlDataResponseFormatter(),
+ 'application/json' => new JsonDataResponseFormatter(),
+ ],
+ ],
+ ],
+];
diff --git a/temporal/config/web/error-handler.php b/temporal/config/web/error-handler.php
new file mode 100644
index 000000000..d97bf3ecf
--- /dev/null
+++ b/temporal/config/web/error-handler.php
@@ -0,0 +1,14 @@
+ JsonRenderer::class,
+];
diff --git a/temporal/config/web/middleware-dispatcher.php b/temporal/config/web/middleware-dispatcher.php
new file mode 100644
index 000000000..616f54c4b
--- /dev/null
+++ b/temporal/config/web/middleware-dispatcher.php
@@ -0,0 +1,14 @@
+ MiddlewareFactory::class,
+];
diff --git a/temporal/config/web/user.php b/temporal/config/web/user.php
new file mode 100644
index 000000000..f41c0ab07
--- /dev/null
+++ b/temporal/config/web/user.php
@@ -0,0 +1,26 @@
+ UserRepository::class,
+ IdentityWithTokenRepositoryInterface::class => UserRepository::class,
+ AuthenticationMethodInterface::class => HttpHeader::class,
+ Authentication::class => [
+ 'class' => Authentication::class,
+ '__construct()' => [
+ 'authenticationFailureHandler' => Reference::to(AuthRequestErrorHandler::class),
+ ],
+ ],
+];
diff --git a/temporal/data/db/database.db b/temporal/data/db/database.db
new file mode 100644
index 000000000..df1dad291
Binary files /dev/null and b/temporal/data/db/database.db differ
diff --git a/temporal/data/nginx/default.conf b/temporal/data/nginx/default.conf
new file mode 100644
index 000000000..4b4fefc2e
--- /dev/null
+++ b/temporal/data/nginx/default.conf
@@ -0,0 +1,57 @@
+server {
+ listen 80;
+
+ set $index_file "public/index.php";
+ set $root "/app";
+
+ root $root;
+ index $index_file;
+
+ error_log /var/log/nginx/error.log; #set
+ access_log /var/log/nginx/access.log; #set
+
+ location ~* \.(js|css|png|html)$ {
+ root $root/public;
+ access_log off;
+ }
+
+ location ~ [^/]\.php(/|$) {
+ fastcgi_pass yii-php:9000;
+ fastcgi_index $root/$index_file;
+ include fastcgi_params;
+ fastcgi_split_path_info ^(.+?\.php)(/.*)$;
+ fastcgi_param PATH_INFO $fastcgi_path_info;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ }
+
+ location / {
+ try_files $uri $uri/ /$index_file?$query_string;
+ }
+}
+
+
+server {
+ listen 81;
+
+ set $index_file "public/index-test.php";
+ set $root "/app";
+
+ root $root;
+ index $index_file;
+
+ error_log /var/log/nginx/error.log; #set
+ access_log /var/log/nginx/access.log; #set
+
+ location ~ [^/]\.php(/|$) {
+ fastcgi_pass yii-php:9000;
+ fastcgi_index $root/$index_file;
+ include fastcgi_params;
+ fastcgi_split_path_info ^(.+?\.php)(/.*)$;
+ fastcgi_param PATH_INFO $fastcgi_path_info;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ }
+
+ location / {
+ try_files $uri $uri/ /$index_file?$query_string;
+ }
+}
diff --git a/temporal/docker-compose.yml b/temporal/docker-compose.yml
new file mode 100644
index 000000000..d48df67dc
--- /dev/null
+++ b/temporal/docker-compose.yml
@@ -0,0 +1,50 @@
+version: '3.5'
+
+services:
+ postgresql:
+ container_name: temporal-postgresql
+ image: postgres:9.6
+ environment:
+ POSTGRES_PASSWORD: temporal
+ POSTGRES_USER: temporal
+ ports:
+ - 5433:5432
+
+ temporal:
+ container_name: temporal
+ image: temporalio/auto-setup:latest
+ depends_on:
+ - postgresql
+ environment:
+ - DB=postgresql
+ - DB_PORT=5432
+ - POSTGRES_USER=temporal
+ - POSTGRES_PWD=temporal
+ - POSTGRES_SEEDS=postgresql
+ - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
+ ports:
+ - 7233:7233
+ volumes:
+ - ./config/temporal/:/etc/temporal/config/dynamicconfig
+
+ temporal-admin-tools:
+ container_name: temporal-admin-tools
+ image: temporalio/admin-tools:latest
+ depends_on:
+ - temporal
+ environment:
+ - TEMPORAL_CLI_ADDRESS=temporal:7233
+ stdin_open: true
+ tty: true
+
+ temporal-web:
+ container_name: temporal-web
+ image: temporalio/web:latest
+ depends_on:
+ - temporal
+ environment:
+ - TEMPORAL_GRPC_ENDPOINT=temporal:7233
+ - TEMPORAL_PERMIT_WRITE_API=true
+ ports:
+ - 8088:8088
+
diff --git a/temporal/infection.json.dist b/temporal/infection.json.dist
new file mode 100644
index 000000000..d319ab15a
--- /dev/null
+++ b/temporal/infection.json.dist
@@ -0,0 +1,16 @@
+{
+ "source": {
+ "directories": [
+ "src"
+ ]
+ },
+ "logs": {
+ "text": "php:\/\/stderr",
+ "badge": {
+ "branch": "master"
+ }
+ },
+ "mutators": {
+ "@default": true
+ }
+}
diff --git a/temporal/phpunit.xml.dist b/temporal/phpunit.xml.dist
new file mode 100644
index 000000000..b1d7346aa
--- /dev/null
+++ b/temporal/phpunit.xml.dist
@@ -0,0 +1,29 @@
+
+
+
+