davekok/sturdy-activity

This package is abandoned and no longer maintained. No replacement package was suggested.

A component to journal activities as they execute and update activity diagrams when you code.

v0.89 2018-12-21 14:47 UTC

This package is auto-updated.

Last update: 2022-05-29 13:56:18 UTC


README

Sturdy Activity is a project to help developers write great micro services. Currently it features two essential components. The HyperMedia component helping developers to write a HyperMedia API and the Activity component which is aimed to help developers write complex long running backend activities.

Currently the HyperMedia component is in good fashion and very useable, though documentation is lacking. The Activity component is still work in progress.

HyperMedia

The HyperMedia class is equiped with several adaptor factory functions. For instance if you wish to use the Symfony framework you can use the HyperMedia::createSymfonyAdaptor to easily work with that framework.

Example:


use Sturdy\Activity\Meta\{Field,Get,Post};

class Person
{
	/**
	 * @Field("string required")
	 */
	public $name;

	/**
	 * The get verb for this resouce.
	 *
	 * @Get
	 * @param  OK $response    the response
	 */
	public function get(\Sturdy\Activity\Response\OK $response): void
	{
		$this->name = "Patrick";
	}

	/**
	 * The post verb for this resouce.
	 *
	 * @Post
	 * @param  OK $response    the response
	 */
	public function post(\Sturdy\Activity\Response\OK $response): void
	{
		$name = $this->name; // $this->name is automatically filled from POST body
	}
}


HyperMedia::createEchoAdaptor(
	new MySharedStateStore(),
	new MyCache(),
	new MyTranslator(),
	new MyJsonDeserializer(),
	"MySourceUnit",
	"/api/",
	"MyNameSpace"
)->handle($_SERVER)->send()