{"id":16675822,"url":"https://github.com/mpyw/compoships-eager-limit","last_synced_at":"2025-03-21T18:31:35.061Z","repository":{"id":37927802,"uuid":"221212403","full_name":"mpyw/compoships-eager-limit","owner":"mpyw","description":"topclaudy/compoships + staudenmeir/eloquent-eager-limit","archived":false,"fork":false,"pushed_at":"2025-03-04T01:01:59.000Z","size":34,"stargazers_count":13,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T01:51:49.591Z","etag":null,"topics":["composite-keys","eagerload","eloquent","laravel","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/mpyw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-11-12T12:26:37.000Z","updated_at":"2025-03-04T17:53:37.000Z","dependencies_parsed_at":"2024-10-28T11:28:21.511Z","dependency_job_id":"735145a4-2e10-4723-b4a8-ce58304fb4ab","html_url":"https://github.com/mpyw/compoships-eager-limit","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"e0fd4e5dabab5f3d7a86265c5f9a7e906ff0c6c0"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpyw%2Fcompoships-eager-limit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpyw%2Fcompoships-eager-limit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpyw%2Fcompoships-eager-limit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpyw%2Fcompoships-eager-limit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpyw","download_url":"https://codeload.github.com/mpyw/compoships-eager-limit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244848580,"owners_count":20520549,"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":["composite-keys","eagerload","eloquent","laravel","php"],"created_at":"2024-10-12T13:08:02.292Z","updated_at":"2025-03-21T18:31:35.049Z","avatar_url":"https://github.com/mpyw.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compoships Eager Limit [![Build Status](https://github.com/mpyw/compoships-eager-limit/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/mpyw/compoships-eager-limit/actions) [![Coverage Status](https://coveralls.io/repos/github/mpyw/compoships-eager-limit/badge.svg?branch=master)](https://coveralls.io/github/mpyw/compoships-eager-limit?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mpyw/compoships-eager-limit/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mpyw/compoships-eager-limit/?branch=master)\n\n[topclaudy/compoships](https://github.com/topclaudy/compoships) + [staudenmeir/eloquent-eager-limit](https://github.com/staudenmeir/eloquent-eager-limit)\n\n\u003e [!CAUTION]\n\u003e [staudenmeir/eloquent-eager-limit](https://github.com/staudenmeir/eloquent-eager-limit) has been merged into the core since Laravel 11. Therefore, it should have been enough to only install [topclaudy/compoships](https://github.com/topclaudy/compoships)... However, as of March 2025, PR [topclaudy/compoships#180](https://github.com/topclaudy/compoships/pull/180) has not yet been merged. Once we have seen this merged, we will abandon the package.\n\n## Requirements\n\n- PHP: `^8.0`\n- Laravel: `^9.0 || ^10.0`\n- [Compoships](https://github.com/topclaudy/compoships): `^2.0.4`\n- [Eloquent Eager Limit](https://github.com/staudenmeir/eloquent-eager-limit): `^1.7.1`\n\n## Installing\n\n```\ncomposer require mpyw/compoships-eager-limit\n```\n\n## Usage\n\n```php\n\u003c?php\n\nnamespace App;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Mpyw\\ComposhipsEagerLimit\\ComposhipsEagerLimit;\n\nclass Post extends Model\n{\n    use ComposhipsEagerLimit;\n\n    public function comments()\n    {\n        return $this-\u003ehasMany(Comment::class);\n    }\n\n    public function authorComments()\n    {\n        return $this-\u003ehasMany(Comment::class, ['post_id', 'user_id'], ['id', 'user_id']);\n    }\n}\n```\n\n```php\n\u003c?php\n\nnamespace App;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse Mpyw\\ComposhipsEagerLimit\\ComposhipsEagerLimit;\n\nclass Comment extends Model\n{\n    use ComposhipsEagerLimit;\n}\n```\n\n```php\n$posts = Post::with(['authorComments' =\u003e function ($query) {\n    $query-\u003elimit(3)-\u003eoffset(1);\n}])-\u003eget();\n```\n\nFor more details, visit each base package repository.\n\n- [topclaudy/compoships](https://github.com/topclaudy/compoships)\n- [staudenmeir/eloquent-eager-limit](https://github.com/staudenmeir/eloquent-eager-limit)\n\n## Special Thanks\n\n- **[@topclaudy](https://github.com/topclaudy)**\n- **[@staudenmeir](https://github.com/staudenmeir)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpyw%2Fcompoships-eager-limit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpyw%2Fcompoships-eager-limit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpyw%2Fcompoships-eager-limit/lists"}