Download the PHP package temporal-php/support without Composer
On this page you can find all versions of the php package temporal-php/support. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download temporal-php/support
More information about temporal-php/support
Files in temporal-php/support
Package support
Short Description Helpers that simplify working with the Temporal PHP SDK
License MIT
Informations about the package support
Temporal PHP Support
Enhance your development experience with Temporal
The package includes attributes, helpers, factories, interfaces, interceptors, etc. to enhance the developer experience when using the Temporal PHP SDK.
- Installation
- Usage
- Factories
- Attributes
- VirtualPromise interface
- Contributing
Installation
To install the package in your PHP application, add it as a dev dependency to your project using Composer:
Usage
Factories
The package provides factories to create Activity and Worker stubs in a more convenient way. With these factories, there is less code because all nested options are moved to the parameters of one method.
Use the \Temporal\Support\Factory\ActivityStub
factory to create an Activity stub:
Use the \Temporal\Support\Factory\WorkflowStub
factory to create a Workflow stub in a client scope:
Or create a Child Workflow stub in a workflow scope:
Attributes
Attributes can be used on Workflow or Activity definitions to set default stub options.
[!NOTE] Attributes will work only if you use the Activity and Worker factories from this package.
[!WARNING] Use attributes on the definitions that you use in factories. So, if you separate interfaces and implementation, apply attributes to the interfaces.
VirtualPromise interface
Every time we use yield
in a Workflow to wait for an action to complete, a Promise is actually yielded.
At this point, the IDE and static analyzer usually get lost in type definitions,
and we experience difficulties and inconveniences because of this.
However, if the Promise interface had the @yield
annotation,
we could explain to the IDE what type of value we expect to be sent back into the generator from the coroutine.
Since ReactPHP isn't yet planning
to add the @yield
annotation to their promises
(Temporal PHP uses ReactPHP promises),
we suggest using our solution for typing - VirtualPromise
.
[!WARNING] don't implement the
VirtualPromise
interface yourself, use it only as a type hint.[!NOTE] PHPStorm and Psalm can handle the
@yield
annotation, but PHPStan can't yet (issue).
Contributing
We believe in the power of community-driven development. Here's how you can contribute:
- Report Bugs: Encounter a glitch? Let us know on our issue tracker.
- Feature Suggestions: Have ideas to improve the package? Create a feature request!
- Code Contributions: Submit a pull request to help us improve the codebase. You can find a list of issues labeled "help wanted" here.
- Spread the Word: Share your experience with the package on social media and encourage others to contribute.
- Donate: Support our work by becoming a patron or making a one-time donation