{"id":15946401,"url":"https://github.com/inmanturbo/modelware","last_synced_at":"2025-06-25T09:04:08.049Z","repository":{"id":252281735,"uuid":"839977280","full_name":"inmanturbo/modelware","owner":"inmanturbo","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-16T13:04:24.000Z","size":54,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T00:05:56.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/inmanturbo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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":"2024-08-08T17:53:14.000Z","updated_at":"2025-05-12T13:11:03.000Z","dependencies_parsed_at":"2024-08-10T21:00:47.676Z","dependency_job_id":null,"html_url":"https://github.com/inmanturbo/modelware","commit_stats":null,"previous_names":["inmanturbo/modelware"],"tags_count":4,"template":false,"template_full_name":"spatie/package-skeleton-laravel","purl":"pkg:github/inmanturbo/modelware","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmanturbo%2Fmodelware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmanturbo%2Fmodelware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmanturbo%2Fmodelware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmanturbo%2Fmodelware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inmanturbo","download_url":"https://codeload.github.com/inmanturbo/modelware/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmanturbo%2Fmodelware/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261215572,"owners_count":23126028,"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-10-07T09:21:34.200Z","updated_at":"2025-06-25T09:04:08.014Z","avatar_url":"https://github.com/inmanturbo.png","language":"PHP","readme":"# Eloquent Modelware for laravel\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/inmanturbo/modelware.svg?style=flat-square)](https://packagist.org/packages/inmanturbo/modelware)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/inmanturbo/modelware/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/inmanturbo/modelware/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/inmanturbo/modelware/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/inmanturbo/modelware/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/inmanturbo/modelware.svg?style=flat-square)](https://packagist.org/packages/inmanturbo/modelware)\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require inmanturbo/modelware\n```\n\n## Usage\n\nAdd modelware in the boot method of a service provider\n\n```php\nuse Inmanturbo\\Modelware\\Facades\\Modelware;\n\nModelware::add('eloquent.updating*', [\n    EnsureModelShouldBeSaved::class,\n    ValidateAttributes::class,\n    FillModel::class,\n], prefix: 'modelware'); // modelware is the default\n```\n\nThis package sends the event data through [pipelines](https://laravel.com/docs/11.x/helpers#pipeline) (similiar to middleware), which iterate through collections of invokable classes, these collections are bound into and resolved from the service container using the following syntax:\n\n```php\n    app()-\u003ebind(\"{$prefix}.{$event}\", function () use ($pipes) {\n        return collect($pipes)-\u003emap(fn ($pipe) =\u003e app($pipe));\n    });\n```\n\nWhere the `{$event}` is a [wildcard event](https://laravel.com/docs/11.x/events#wildcard-event-listeners) for eloquent:\n\n- `modelware.eloquent.creating*` =\u003e `eloquent.creating*`\n- `modelware.eloquent.updating*` =\u003e `eloquent.updating*`\n- `modelware.eloquent.deleting*` =\u003e `eloquent.deleting*`\n\nThis package will send the following data object through your custom pipeline:\n\n```php\n$data = app(Data::class, [\n    'event' =\u003e $events,\n    'model' =\u003e $payload[0],\n    'payload' =\u003e $payload,\n]);\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [inmanturbo](https://github.com/inmanturbo)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finmanturbo%2Fmodelware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finmanturbo%2Fmodelware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finmanturbo%2Fmodelware/lists"}