{"id":18369752,"url":"https://github.com/dazzle-php/event","last_synced_at":"2025-04-06T18:32:27.987Z","repository":{"id":56963800,"uuid":"95317280","full_name":"dazzle-php/event","owner":"dazzle-php","description":"Dazzle Async Events \u0026 Dispatchers","archived":false,"fork":false,"pushed_at":"2017-08-20T18:06:07.000Z","size":41,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T04:23:50.523Z","etag":null,"topics":["async","dazzle","dispatcher","event","event-driven","event-emitter","event-handler","event-handling","php","php-lib","php7"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dazzle-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-24T19:05:21.000Z","updated_at":"2025-03-11T20:29:58.000Z","dependencies_parsed_at":"2022-08-21T10:20:23.261Z","dependency_job_id":null,"html_url":"https://github.com/dazzle-php/event","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dazzle-php%2Fevent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dazzle-php%2Fevent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dazzle-php%2Fevent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dazzle-php%2Fevent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dazzle-php","download_url":"https://codeload.github.com/dazzle-php/event/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247531267,"owners_count":20953929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","dazzle","dispatcher","event","event-driven","event-emitter","event-handler","event-handling","php","php-lib","php7"],"created_at":"2024-11-05T23:31:35.295Z","updated_at":"2025-04-06T18:32:24.701Z","avatar_url":"https://github.com/dazzle-php.png","language":"PHP","readme":"# Dazzle Events \u0026 Dispatchers\n\n[![Build Status](https://travis-ci.org/dazzle-php/event.svg)](https://travis-ci.org/dazzle-php/event)\n[![Code Coverage](https://scrutinizer-ci.com/g/dazzle-php/event/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/dazzle-php/event/?branch=master)\n[![Code Quality](https://scrutinizer-ci.com/g/dazzle-php/event/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dazzle-php/event/?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/dazzle-php/event/v/stable)](https://packagist.org/packages/dazzle-php/event) \n[![Latest Unstable Version](https://poser.pugx.org/dazzle-php/event/v/unstable)](https://packagist.org/packages/dazzle-php/event) \n[![License](https://poser.pugx.org/dazzle-php/event/license)](https://packagist.org/packages/dazzle-php/event/license)\n\n\u003e **Note:** This repository is part of [Dazzle Project](https://github.com/dazzle-php/dazzle) - the next-gen library for PHP. The project's purpose is to provide PHP developers with a set of complete tools to build functional async applications. Please, make sure you read the attached README carefully and it is guaranteed you will be surprised how easy to use and powerful it is. In the meantime, you might want to check out the rest of our async libraries in [Dazzle repository](https://github.com/dazzle-php) for the full extent of Dazzle experience.\n\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/dazzle-php/dazzle/master/media/dazzle-x125.png\" /\u003e\n\u003c/p\u003e\n\n## Description\n\nDazzle Event is a library which purpose is to provide all of the tools that are required to implement event-based architecture in any application. It delivers classes and interfaces designed specifically for that exact purpose and is designed to be easy to work with, efficient and effective.\n\n## Feature Highlights\n\nDazzle Event features:\n\n* Support for working with events, event-dispatchers and event-handlers,\n* Support for synchronous events,\n* Support for asynchronous events using loop,\n* Built-in event handlers,\n* Built-in expanded interfaces for attaching listeners and managing events propagation,\n* ...and more.\n\n## Provided Example(s)\n\n### Quickstart\n\n```php\nuse Dazzle\\Event\\EventEmitter;\n\n$emitter = new EventEmitter();\n\n$emitter-\u003eon('script.start', function($user, $time) {\n    echo \"User '$user' has started this script at $time.\\n\";\n});\n\n$emitter-\u003eemit('script.start', [ get_current_user(), date('H:i:s Y-m-d') ]);\n```\n\n### Additional\n\nAdditional examples can be found in [example](https://github.com/dazzle-php/event/tree/master/example) directory. Below is the list of provided examples as a reference and preferred consumption order:\n\n- [Quickstart](https://github.com/dazzle-php/event/blob/master/example/events_quickstart.php)\n- [Using multiple listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_multiple.php)\n- [Using disposable (one-time) listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_disposable.php)\n- [Using delayed listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_delayed.php)\n- [Using exact (multiple-times) listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_exact.php)\n- [Using mixed listeners](https://github.com/dazzle-php/event/blob/master/example/events_handlers_mixed.php)\n- [Cancelling](https://github.com/dazzle-php/event/blob/master/example/events_cancelling.php)\n- [__Advanced:__ Asynchronous event-emitters](https://github.com/dazzle-php/event/blob/master/example/advanced_async_emitters.php)\n- [__Advanced:__ Copying events](https://github.com/dazzle-php/event/blob/master/example/advanced_flow_copying_events.php)\n- [__Advanced:__ Forwarding events](https://github.com/dazzle-php/event/blob/master/example/advanced_flow_forwarding_events.php)\n- [__Advanced:__ Chaining events propagation](https://github.com/dazzle-php/event/blob/master/example/advanced_flow_chaining.php)\n- [__Advanced:__ Switching propagation modes of event-emitters](https://github.com/dazzle-php/event/blob/master/example/advanced_flow_switching_modes.php)\n\nIf any of the above examples has left you confused, please take a look in the [tests](https://github.com/dazzle-php/event/tree/master/test) directory as well.\n\n## Comparison\n\nThis section contains Dazzle vs React comparison many users requested. If you are wondering why this section has been created, see the [author's note](https://github.com/dazzle-php/dazzle/blob/master/NOTE.md).\n\n#### Performance\n\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/dazzle-php/dazzle/master/media/lib/event/graph-perf-cpu.png\" /\u003e\n\u003c/p\u003e\n\nThe detailed information about this benchmark can be found in [benchmark-on.php](https://github.com/dazzle-php/event/blob/master/example-bench/benchmark-on.php) and [benchmark-on-react.php](https://github.com/dazzle-php/event/blob/master/example-bench/benchmark-on-react.php) files.\n\n#### Memory Allocation Efficiency\n\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/dazzle-php/dazzle/master/media/lib/event/graph-perf-mem.png\" /\u003e\n\u003c/p\u003e\n\nThe detailed information about this benchmark can be found in [benchmark-once.php](https://github.com/dazzle-php/event/blob/master/example-bench/benchmark-once.php) and [benchmark-once-react.php](https://github.com/dazzle-php/event/blob/master/example-bench/benchmark-once-react.php) files.\n\n#### Details\n\n| Detail | Dazzle Event | React-equivalent |\n| :--- | :---: | :---: |\n| Active support | X | ? |\n| Provided well-formed documentation | X | X |\n| Provided well-formed set of tests with at least 80% coverage and API examples | X | X |\n| Use of events with continous listeners | X | X |\n| Use of events with single-use listeners | X | X |\n| Use of events with delayed listeners | X | |\n| Use of events with exact-time listeners | X | |\n| Use of events with mixed-type listeners | X | |\n| Cancelling listeners | X | X |\n| Asynchronous emitters | X | |\n| Copying events | X | |\n| Forwarding events | X | |\n| Different modes of events propagation | X | |\n\n## Requirements\n\nDazzle Event requires:\n\n* PHP-5.6 or PHP-7.0+,\n* UNIX or Windows OS.\n\n## Installation\n\nTo install this library make sure you have [composer](https://getcomposer.org/) installed, then run following command:\n\n```\n$\u003e composer require dazzle-php/event\n```\n\n## Tests\n\nTests can be run via:\n\n```\n$\u003e vendor/bin/phpunit -d memory_limit=1024M\n```\n\n## Versioning\n\nVersioning of Dazzle libraries is being shared between all packages included in [Dazzle Project](https://github.com/dazzle-php/dazzle). That means the releases are being made concurrently for all of them. On one hand this might lead to \"empty\" releases for some packages at times, but don't worry. In the end it is far much easier for contributors to maintain and -- what's the most important -- much more straight-forward for users to understand the compatibility and inter-operability of the packages.\n\n## Contributing\n\nThank you for considering contributing to this repository! \n\n- The contribution guide can be found in the [contribution tips](https://github.com/dazzle-php/event/blob/master/CONTRIBUTING.md). \n- Open tickets can be found in [issues section](https://github.com/dazzle-php/event/issues). \n- Current contributors are listed in [graphs section](https://github.com/dazzle-php/event/graphs/contributors)\n- To contact the author(s) see the information attached in [composer.json](https://github.com/dazzle-php/event/blob/master/composer.json) file.\n\n## License\n\nDazzle Framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).\n\n\u003chr\u003e\n\u003cp align=\"center\"\u003e\n\u003ci\u003e\"Everything is possible. The impossible just takes longer.\"\u003c/i\u003e ― Dan Brown\n\u003c/p\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdazzle-php%2Fevent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdazzle-php%2Fevent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdazzle-php%2Fevent/lists"}