{"id":20187951,"url":"https://github.com/commonphp/events","last_synced_at":"2026-06-09T10:31:55.404Z","repository":{"id":222933485,"uuid":"758761890","full_name":"commonphp/events","owner":"commonphp","description":"A powerful and flexible system to handle event-driven programming within PHP applications. It provides mechanisms for event registration, de-registration, triggering, and dynamic hook management.","archived":false,"fork":false,"pushed_at":"2025-03-15T18:09:27.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-30T19:52:25.232Z","etag":null,"topics":["commonphp","event-listeners","event-management","events","hooks","open-source","php"],"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/commonphp.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":"contributing.md","funding":null,"license":"license.md","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-17T02:34:05.000Z","updated_at":"2025-03-15T18:08:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"2a9cc1a2-7849-4950-80a8-a8a034f2ea26","html_url":"https://github.com/commonphp/events","commit_stats":null,"previous_names":["commonphp/events"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/commonphp/events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fevents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fevents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fevents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fevents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commonphp","download_url":"https://codeload.github.com/commonphp/events/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fevents/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34103355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["commonphp","event-listeners","event-management","events","hooks","open-source","php"],"created_at":"2024-11-14T03:26:46.161Z","updated_at":"2026-06-09T10:31:55.396Z","avatar_url":"https://github.com/commonphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CommonPHP Events\n\nA lightweight, PSR-14 compatible event dispatching library designed for simplicity and efficiency. It provides a global yet replaceable event dispatcher, supports prioritized listeners, and allows flexible event handling.\n\n## Features\n\n- **PSR-14 Compatible:** Implements the standard event dispatcher interface.\n- **Simple Event Registration:** Easily register and dispatch events.\n- **Prioritized Listeners:** Control execution order with priority levels.\n- **Global or Dependency Injected:** Use globally or inject as needed.\n- **Supports Stoppable Events:** Halt propagation when necessary.\n\n## Installation\n\nInstall via Composer:\n\n```bash\ncomposer require comphp/events\n```\n\n## Usage\n\nCreate and dispatch events using the `EventDispatcher`.\n\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\n\nuse Neuron\\Events\\EventDispatcher;\nuse Neuron\\Events\\AbstractEvent;\n\n// Define an event\nclass UserRegisteredEvent extends AbstractEvent\n{\n    public function __construct(private string $username)\n    {\n        parent::__construct(['username' =\u003e $username]);\n    }\n}\n\n// Initialize the dispatcher\n$dispatcher = new EventDispatcher();\n\n// Register a listener\n$dispatcher-\u003elisten(UserRegisteredEvent::class, function (UserRegisteredEvent $event) {\n    echo \"User registered: \" . $event-\u003egetPayload()['username'] . \"\\n\";\n});\n\n// Dispatch the event\n$dispatcher-\u003edispatch(new UserRegisteredEvent('Tim'));\n```\n\n## Examples\n\nAdditional example scripts are provided in the `examples/` directory, demonstrating different use cases of event dispatching.\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for a record of changes.\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to help out.\n\n## Code of Conduct\n\nThis project is released under a Code of Conduct. Please review [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for details.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE.md). See the LICENSE file for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonphp%2Fevents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommonphp%2Fevents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonphp%2Fevents/lists"}