Compare commits

..

2 Commits

Author SHA1 Message Date
ac735d8bf5 Version 1.2.0
- Event publishing without queue
- Broadcastable event can be non json serializable
2026-02-27 01:16:02 +04:00
6b044074ce Broadcastable event shouldnt be a JsonSerializable everytime 2026-02-27 01:14:21 +04:00
2 changed files with 68 additions and 75 deletions

View File

@@ -33,8 +33,9 @@ return [
### 1. Creating regular events for publishing to a RabbitMQ ### 1. Creating regular events for publishing to a RabbitMQ
Create an event that implements the `Broadcast` interface. `Broadcast` interface Create an event that implements the `Broadcast` interface.
extends `JsonSerializable` then your event should implements `jsonSerialize` method. Your event should implements `JsonSerializable` interface if
default serializer is used.
```php ```php
namespace App\Events; namespace App\Events;
@@ -42,8 +43,9 @@ namespace App\Events;
use Diffhead\PHP\LaravelRabbitMQ\Event\Broadcast; use Diffhead\PHP\LaravelRabbitMQ\Event\Broadcast;
use Diffhead\PHP\LaravelRabbitMQ\Trait\BroadcastEvent; use Diffhead\PHP\LaravelRabbitMQ\Trait\BroadcastEvent;
use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Foundation\Events\Dispatchable;
use JsonSerializable;
class UserCreated implements Broadcast class UserCreated implements Broadcast, JsonSerializable
{ {
use Dispatchable, BroadcastEvent; use Dispatchable, BroadcastEvent;

135
composer.lock generated
View File

@@ -3554,22 +3554,21 @@
}, },
{ {
"name": "symfony/clock", "name": "symfony/clock",
"version": "v7.4.0", "version": "v8.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/clock.git", "url": "https://github.com/symfony/clock.git",
"reference": "9169f24776edde469914c1e7a1442a50f7a4e110" "reference": "832119f9b8dbc6c8e6f65f30c5969eca1e88764f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/clock/zipball/9169f24776edde469914c1e7a1442a50f7a4e110", "url": "https://api.github.com/repos/symfony/clock/zipball/832119f9b8dbc6c8e6f65f30c5969eca1e88764f",
"reference": "9169f24776edde469914c1e7a1442a50f7a4e110", "reference": "832119f9b8dbc6c8e6f65f30c5969eca1e88764f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=8.2", "php": ">=8.4",
"psr/clock": "^1.0", "psr/clock": "^1.0"
"symfony/polyfill-php83": "^1.28"
}, },
"provide": { "provide": {
"psr/clock-implementation": "1.0" "psr/clock-implementation": "1.0"
@@ -3608,7 +3607,7 @@
"time" "time"
], ],
"support": { "support": {
"source": "https://github.com/symfony/clock/tree/v7.4.0" "source": "https://github.com/symfony/clock/tree/v8.0.0"
}, },
"funding": [ "funding": [
{ {
@@ -3628,7 +3627,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2025-11-12T15:39:26+00:00" "time": "2025-11-12T15:46:48+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
@@ -3730,20 +3729,20 @@
}, },
{ {
"name": "symfony/css-selector", "name": "symfony/css-selector",
"version": "v7.4.6", "version": "v8.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/css-selector.git", "url": "https://github.com/symfony/css-selector.git",
"reference": "2e7c52c647b406e2107dd867db424a4dbac91864" "reference": "2a178bf80f05dbbe469a337730eba79d61315262"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/2e7c52c647b406e2107dd867db424a4dbac91864", "url": "https://api.github.com/repos/symfony/css-selector/zipball/2a178bf80f05dbbe469a337730eba79d61315262",
"reference": "2e7c52c647b406e2107dd867db424a4dbac91864", "reference": "2a178bf80f05dbbe469a337730eba79d61315262",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=8.2" "php": ">=8.4"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@@ -3775,7 +3774,7 @@
"description": "Converts CSS selectors to XPath expressions", "description": "Converts CSS selectors to XPath expressions",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/css-selector/tree/v7.4.6" "source": "https://github.com/symfony/css-selector/tree/v8.0.6"
}, },
"funding": [ "funding": [
{ {
@@ -3795,7 +3794,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-02-17T07:53:42+00:00" "time": "2026-02-17T13:07:04+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@@ -3948,24 +3947,24 @@
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v7.4.4", "version": "v8.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
"reference": "dc2c0eba1af673e736bb851d747d266108aea746" "reference": "99301401da182b6cfaa4700dbe9987bb75474b47"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/dc2c0eba1af673e736bb851d747d266108aea746", "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/99301401da182b6cfaa4700dbe9987bb75474b47",
"reference": "dc2c0eba1af673e736bb851d747d266108aea746", "reference": "99301401da182b6cfaa4700dbe9987bb75474b47",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=8.2", "php": ">=8.4",
"symfony/event-dispatcher-contracts": "^2.5|^3" "symfony/event-dispatcher-contracts": "^2.5|^3"
}, },
"conflict": { "conflict": {
"symfony/dependency-injection": "<6.4", "symfony/security-http": "<7.4",
"symfony/service-contracts": "<2.5" "symfony/service-contracts": "<2.5"
}, },
"provide": { "provide": {
@@ -3974,14 +3973,14 @@
}, },
"require-dev": { "require-dev": {
"psr/log": "^1|^2|^3", "psr/log": "^1|^2|^3",
"symfony/config": "^6.4|^7.0|^8.0", "symfony/config": "^7.4|^8.0",
"symfony/dependency-injection": "^6.4|^7.0|^8.0", "symfony/dependency-injection": "^7.4|^8.0",
"symfony/error-handler": "^6.4|^7.0|^8.0", "symfony/error-handler": "^7.4|^8.0",
"symfony/expression-language": "^6.4|^7.0|^8.0", "symfony/expression-language": "^7.4|^8.0",
"symfony/framework-bundle": "^6.4|^7.0|^8.0", "symfony/framework-bundle": "^7.4|^8.0",
"symfony/http-foundation": "^6.4|^7.0|^8.0", "symfony/http-foundation": "^7.4|^8.0",
"symfony/service-contracts": "^2.5|^3", "symfony/service-contracts": "^2.5|^3",
"symfony/stopwatch": "^6.4|^7.0|^8.0" "symfony/stopwatch": "^7.4|^8.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@@ -4009,7 +4008,7 @@
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/event-dispatcher/tree/v7.4.4" "source": "https://github.com/symfony/event-dispatcher/tree/v8.0.4"
}, },
"funding": [ "funding": [
{ {
@@ -4029,7 +4028,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-01-05T11:45:34+00:00" "time": "2026-01-05T11:45:55+00:00"
}, },
{ {
"name": "symfony/event-dispatcher-contracts", "name": "symfony/event-dispatcher-contracts",
@@ -5617,35 +5616,34 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v7.4.6", "version": "v8.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "9f209231affa85aa930a5e46e6eb03381424b30b" "reference": "6c9e1108041b5dce21a9a4984b531c4923aa9ec4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/9f209231affa85aa930a5e46e6eb03381424b30b", "url": "https://api.github.com/repos/symfony/string/zipball/6c9e1108041b5dce21a9a4984b531c4923aa9ec4",
"reference": "9f209231affa85aa930a5e46e6eb03381424b30b", "reference": "6c9e1108041b5dce21a9a4984b531c4923aa9ec4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=8.2", "php": ">=8.4",
"symfony/deprecation-contracts": "^2.5|^3.0", "symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "^1.33",
"symfony/polyfill-intl-grapheme": "~1.33", "symfony/polyfill-intl-normalizer": "^1.0",
"symfony/polyfill-intl-normalizer": "~1.0", "symfony/polyfill-mbstring": "^1.0"
"symfony/polyfill-mbstring": "~1.0"
}, },
"conflict": { "conflict": {
"symfony/translation-contracts": "<2.5" "symfony/translation-contracts": "<2.5"
}, },
"require-dev": { "require-dev": {
"symfony/emoji": "^7.1|^8.0", "symfony/emoji": "^7.4|^8.0",
"symfony/http-client": "^6.4|^7.0|^8.0", "symfony/http-client": "^7.4|^8.0",
"symfony/intl": "^6.4|^7.0|^8.0", "symfony/intl": "^7.4|^8.0",
"symfony/translation-contracts": "^2.5|^3.0", "symfony/translation-contracts": "^2.5|^3.0",
"symfony/var-exporter": "^6.4|^7.0|^8.0" "symfony/var-exporter": "^7.4|^8.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@@ -5684,7 +5682,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v7.4.6" "source": "https://github.com/symfony/string/tree/v8.0.6"
}, },
"funding": [ "funding": [
{ {
@@ -5704,38 +5702,31 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-02-09T09:33:46+00:00" "time": "2026-02-09T10:14:57+00:00"
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v7.4.6", "version": "v8.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "1888cf064399868af3784b9e043240f1d89d25ce" "reference": "13ff19bcf2bea492d3c2fbeaa194dd6f4599ce1b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/1888cf064399868af3784b9e043240f1d89d25ce", "url": "https://api.github.com/repos/symfony/translation/zipball/13ff19bcf2bea492d3c2fbeaa194dd6f4599ce1b",
"reference": "1888cf064399868af3784b9e043240f1d89d25ce", "reference": "13ff19bcf2bea492d3c2fbeaa194dd6f4599ce1b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=8.2", "php": ">=8.4",
"symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "^1.0",
"symfony/polyfill-mbstring": "~1.0", "symfony/translation-contracts": "^3.6.1"
"symfony/translation-contracts": "^2.5.3|^3.3"
}, },
"conflict": { "conflict": {
"nikic/php-parser": "<5.0", "nikic/php-parser": "<5.0",
"symfony/config": "<6.4",
"symfony/console": "<6.4",
"symfony/dependency-injection": "<6.4",
"symfony/http-client-contracts": "<2.5", "symfony/http-client-contracts": "<2.5",
"symfony/http-kernel": "<6.4", "symfony/service-contracts": "<2.5"
"symfony/service-contracts": "<2.5",
"symfony/twig-bundle": "<6.4",
"symfony/yaml": "<6.4"
}, },
"provide": { "provide": {
"symfony/translation-implementation": "2.3|3.0" "symfony/translation-implementation": "2.3|3.0"
@@ -5743,17 +5734,17 @@
"require-dev": { "require-dev": {
"nikic/php-parser": "^5.0", "nikic/php-parser": "^5.0",
"psr/log": "^1|^2|^3", "psr/log": "^1|^2|^3",
"symfony/config": "^6.4|^7.0|^8.0", "symfony/config": "^7.4|^8.0",
"symfony/console": "^6.4|^7.0|^8.0", "symfony/console": "^7.4|^8.0",
"symfony/dependency-injection": "^6.4|^7.0|^8.0", "symfony/dependency-injection": "^7.4|^8.0",
"symfony/finder": "^6.4|^7.0|^8.0", "symfony/finder": "^7.4|^8.0",
"symfony/http-client-contracts": "^2.5|^3.0", "symfony/http-client-contracts": "^2.5|^3.0",
"symfony/http-kernel": "^6.4|^7.0|^8.0", "symfony/http-kernel": "^7.4|^8.0",
"symfony/intl": "^6.4|^7.0|^8.0", "symfony/intl": "^7.4|^8.0",
"symfony/polyfill-intl-icu": "^1.21", "symfony/polyfill-intl-icu": "^1.21",
"symfony/routing": "^6.4|^7.0|^8.0", "symfony/routing": "^7.4|^8.0",
"symfony/service-contracts": "^2.5|^3", "symfony/service-contracts": "^2.5|^3",
"symfony/yaml": "^6.4|^7.0|^8.0" "symfony/yaml": "^7.4|^8.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@@ -5784,7 +5775,7 @@
"description": "Provides tools to internationalize your application", "description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/translation/tree/v7.4.6" "source": "https://github.com/symfony/translation/tree/v8.0.6"
}, },
"funding": [ "funding": [
{ {
@@ -5804,7 +5795,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2026-02-17T07:53:42+00:00" "time": "2026-02-17T13:07:04+00:00"
}, },
{ {
"name": "symfony/translation-contracts", "name": "symfony/translation-contracts",