tourze/async-contracts

εΌ‚ζ­₯

Maintainers

πŸ‘ tourze

Package info

github.com/tourze/async-contracts

pkg:composer/tourze/async-contracts

Statistics

Installs: 12 996

Dependents: 20

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2025-10-31 05:09 UTC

Requires

  • php: ^8.2
  • composer-runtime-api: ^2.0

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT da25cabd4e981011d98fdbed1861319d4c7dccad

This package is auto-updated.

Last update: 2026-06-19 09:34:45 UTC


README

English | δΈ­ζ–‡

A simple contract package that provides interfaces for asynchronous messaging in PHP applications. This package defines the basic contract for async message handling without any implementation details.

Installation

composer require tourze/async-contracts

Quick Start

This package provides a base interface for async message handling:

<?php

use Tourze\AsyncContracts\AsyncMessageInterface;

// Implement the interface in your async message classes
class MyAsyncMessage implements AsyncMessageInterface
{
 // Your implementation here
}

Usage

The AsyncMessageInterface serves as a marker interface for async message objects. It currently contains no methods, allowing maximum flexibility for implementers to define their own message structure.

<?php

namespace App\Messages;

use Tourze\AsyncContracts\AsyncMessageInterface;

class UserRegistrationMessage implements AsyncMessageInterface
{
 public function __construct(
 private string $userId,
 private string $email
 ) {}

 public function getUserId(): string
 {
 return $this->userId;
 }

 public function getEmail(): string
 {
 return $this->email;
 }
}

Requirements

  • PHP 8.1 or higher

Testing

./vendor/bin/phpunit packages/async-contracts/tests

License

This package is open-source software licensed under the MIT license.