{"id":13828160,"url":"https://github.com/envant/fireable","last_synced_at":"2026-01-11T16:08:42.498Z","repository":{"id":35121706,"uuid":"209407300","full_name":"envant/fireable","owner":"envant","description":"An elegant way to trigger Laravel events based on attributes changes.","archived":false,"fork":false,"pushed_at":"2024-03-01T16:58:19.000Z","size":45,"stargazers_count":448,"open_issues_count":3,"forks_count":23,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-08T11:14:28.332Z","etag":null,"topics":[],"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/envant.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":"contributing.md","funding":null,"license":"license.md","code_of_conduct":null,"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}},"created_at":"2019-09-18T21:29:40.000Z","updated_at":"2024-09-18T20:08:46.000Z","dependencies_parsed_at":"2024-06-18T15:23:23.807Z","dependency_job_id":null,"html_url":"https://github.com/envant/fireable","commit_stats":{"total_commits":41,"total_committers":9,"mean_commits":4.555555555555555,"dds":0.6585365853658536,"last_synced_commit":"572f3ab74d8a3631e4fa8acf12998ef376fac87d"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envant%2Ffireable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envant%2Ffireable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envant%2Ffireable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/envant%2Ffireable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/envant","download_url":"https://codeload.github.com/envant/fireable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225486554,"owners_count":17481924,"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":[],"created_at":"2024-08-04T09:02:34.781Z","updated_at":"2026-01-11T16:08:42.443Z","avatar_url":"https://github.com/envant.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Fireable\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![StyleCI](https://styleci.io/repos/209407300/shield)](https://styleci.io/repos/209407300)\n[![Build Status](https://travis-ci.org/envant/fireable.svg?branch=master)](https://travis-ci.org/envant/fireable)\n[![Total Downloads][ico-downloads]][link-downloads]\n\nAn elegant way to trigger events based on attributes changes.\n\n## Installation\n\nInstall package through Composer\n\n``` bash\n$ composer require envant/fireable\n```\n\n## Usage\n\n1. Add the `FireableAttributes` trait to your model\n2. Define the attributes with specified events via the `protected $fireableAttributes` property on the model\n\n### Example\n\nLet's say we need to trigger specified events when specific model attributes are updated.\n\nFor example, you need to notify user when he gets an \"approved\" status. Instead of observing model's \"dirty\" attributes and firing events manually we could do it more elegantly by assigning specified events to attributes or even certain values of attributes.\n\n```php\nclass User extends Authenticatable\n{\n    use FireableAttributes;\n\n    protected $fireableAttributes = [\n        'status' =\u003e [\n            'approved' =\u003e UserApproved::class,\n            'rejected' =\u003e UserRejected::class,\n        ],\n    ];\n}\n```\n\nAlso you may not need to track certain values, so you can assign an event directly to an attribute itself. So, in the example below, each time the user's email is changed, the appropriate event will be fired.\n\n```php\nclass User extends Authenticatable\n{\n    use FireableAttributes;\n\n    protected $fireableAttributes = [\n        'email' =\u003e EmailUpdated::class,\n    ];\n}\n```\n\n## Change log\n\nPlease see the [changelog](changelog.md) for more information on what has changed recently.\n\n## Testing\n\n``` bash\n$ composer test\n```\n\n## Contributing\n\nPlease see [contributing.md](contributing.md) for details and a todolist.\n\n## Security\n\nIf you discover any security related issues, please email author email instead of using the issue tracker.\n\n## Credits\n\n- [Boris Lepikhin][link-author]\n- [All Contributors][link-contributors]\n\n## License\n\nlicense. Please see the [license file](license.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/envant/fireable.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/envant/fireable.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/envant/fireable\n[link-downloads]: https://packagist.org/packages/envant/fireable\n[link-author]: https://github.com/envant\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvant%2Ffireable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenvant%2Ffireable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenvant%2Ffireable/lists"}