Compare commits

..

2 Commits

Author SHA1 Message Date
8320fb4a84 Version 1.2.0
- Event publishing without queue
- Broadcastable event can be non json serializable
2026-02-27 00:44:57 +04:00
c481c961fb Broadcastable event shouldnt be a JsonSerializable everytime 2026-02-27 00:43:06 +04:00
2 changed files with 75 additions and 68 deletions

View File

@@ -33,9 +33,8 @@ 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. Create an event that implements the `Broadcast` interface. `Broadcast` interface
Your event should implements `JsonSerializable` interface if extends `JsonSerializable` then your event should implements `jsonSerialize` method.
default serializer is used.
```php ```php
namespace App\Events; namespace App\Events;
@@ -43,9 +42,8 @@ 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, JsonSerializable class UserCreated implements Broadcast
{ {
use Dispatchable, BroadcastEvent; use Dispatchable, BroadcastEvent;

135
composer.lock generated
View File

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