Skip to content

Instantly share code, notes, and snippets.

@dgafka
Last active January 16, 2022 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgafka/8626fd96480eb03089fc82e93a831526 to your computer and use it in GitHub Desktop.
Save dgafka/8626fd96480eb03089fc82e93a831526 to your computer and use it in GitHub Desktop.
microservices-integration-in-php-05.php
<?php
class UserService
{
public function __construct(private DistributedBus $distributedBus) {}
public function banUser(int $personId): void
{
// ban the user
$this->distributedBus->publishEvent(
"user.was_banned", // 1
\json_encode(["personId" => $personId]), // 2
"application/json" // 3
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment