{"id":13817730,"url":"https://github.com/morilog/flexible-repository","last_synced_at":"2025-08-11T23:15:09.311Z","repository":{"id":57019877,"uuid":"73276150","full_name":"morilog/flexible-repository","owner":"morilog","description":"Reposiotry Pattern implemention for PHP (inc: Laravel, Symfony, ...)","archived":false,"fork":false,"pushed_at":"2017-03-15T18:19:20.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-03T16:14:08.706Z","etag":null,"topics":["ddd","doctrine","eloquent","eloquent-orm-models","laravel","php","repository-pattern","symfony"],"latest_commit_sha":null,"homepage":"http://morilog.ir","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/morilog.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}},"created_at":"2016-11-09T10:58:32.000Z","updated_at":"2020-09-09T08:02:17.000Z","dependencies_parsed_at":"2022-08-22T20:31:15.971Z","dependency_job_id":null,"html_url":"https://github.com/morilog/flexible-repository","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/morilog/flexible-repository","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morilog%2Fflexible-repository","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morilog%2Fflexible-repository/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morilog%2Fflexible-repository/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morilog%2Fflexible-repository/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morilog","download_url":"https://codeload.github.com/morilog/flexible-repository/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morilog%2Fflexible-repository/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269970120,"owners_count":24505466,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"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":["ddd","doctrine","eloquent","eloquent-orm-models","laravel","php","repository-pattern","symfony"],"created_at":"2024-08-04T06:00:54.336Z","updated_at":"2025-08-11T23:15:09.288Z","avatar_url":"https://github.com/morilog.png","language":"PHP","funding_links":[],"categories":["پی اچ پی PHP"],"sub_categories":[],"readme":"# Laravel Flexible Repository\nA Laravel package for creating Flexible and powerful repositories\n\n## Installation\n```shell\ncomposer require morilog/flexible-repository\n```\n\n## Usage\n\n### Create Repositories\n\n#### Create for Eloquent\n- Create an `interface` for your repository that extended from `Morilog\\FlexibleRepository\\Contracts\\RepositoryInterface`\n\n```php\n\u003c?php\nnamesapce App\\Reposiotries;\n\nuse Morilog\\FlexibleRepository\\Contracts\\RepositoryInterface;\n\ninterface UserRepository extends RepositoryInterface\n{\n}\n```\n\n\n- Create a class For your model that extended from `Morilog\\FlexibleRepository\\BaseEloquentRepository` and implements your declared `interface`\n\n```php\n\u003c?php\nnamespace App\\Repositories;\n\nuse Morilog\\FlexibleRepository\\BaseEloquentRepository;\nuse App\\Models\\User;\n\nclass EloquentUserRepository extends BaseEloquentRepository implements UserRepository\n{\n    protected function model()\n    {\n        return User::class;\n    }\n}\n```\n\n\n- Bind your Repository to implemented class\n\n```php\n\u003c?php\nnamespace App\\Providers;\n\nuse Illuminate\\Support\\ServiceProvider;\nuse App\\Repositories\\UserRepository;\nuse App\\Repositories\\EloqeuntUserRepository;\n\nclass RepositoryServiceProvider extends ServiceProvider\n{\n    public function register()\n    {\n         $this-\u003eapp-\u003ebind(UserRepository::class, function ($app) {\n            return new EloquentUserRepository($app);\n         });\n         \n        // or\n        // $this-\u003eapp-\u003ebind(UserRepository::class, EloquentUserRepository::class);\n        \n    }\n}\n```\n\n- Inject your repository in classes and controller methods\n```php\n\u003c?php\nnamespace App\\Http\\Controllers;\n\nuse App\\Repositories\\UserReposiotry;\n\nclass UsersController extends Controller\n{\n    public function index(UserRepository $repository)\n    {\n        return $repository-\u003eall();\n    }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorilog%2Fflexible-repository","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorilog%2Fflexible-repository","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorilog%2Fflexible-repository/lists"}