{"id":24780428,"url":"https://github.com/webgriffe/in-memory-repository","last_synced_at":"2026-02-11T05:01:17.638Z","repository":{"id":62547703,"uuid":"453453994","full_name":"webgriffe/in-memory-repository","owner":"webgriffe","description":"An \"in-memory\" implementation of Doctrine repository","archived":false,"fork":false,"pushed_at":"2025-12-23T09:37:35.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-12-24T23:28:47.850Z","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/webgriffe.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":"2022-01-29T16:34:16.000Z","updated_at":"2025-12-23T09:33:29.000Z","dependencies_parsed_at":"2025-01-29T10:30:47.120Z","dependency_job_id":"6b9e2528-d7ad-4689-8571-9be091754955","html_url":"https://github.com/webgriffe/in-memory-repository","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/webgriffe/in-memory-repository","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Fin-memory-repository","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Fin-memory-repository/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Fin-memory-repository/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Fin-memory-repository/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webgriffe","download_url":"https://codeload.github.com/webgriffe/in-memory-repository/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webgriffe%2Fin-memory-repository/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29327092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T03:52:29.695Z","status":"ssl_error","status_checked_at":"2026-02-11T03:52:23.094Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2025-01-29T10:30:39.999Z","updated_at":"2026-02-11T05:01:17.613Z","avatar_url":"https://github.com/webgriffe.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Doctrine \"in-memory\" Repository\n\nThis library is an \"in-memory\" implementation of the `Doctrine\\Persistence\\ObjectRepository` interface.\nIt can be used to unit test components which depends on Doctrine repositories without involving a real database.\n\n## Installation\n\nAdd it to your \"dev\" dependencies:\n\n```bash\ncomposer require --dev webgriffe/in-memory-repository\n```\n\n## Usage\n\nLet's assume that you're building a movie management application and you have a Doctrine's `MovieRepository` (which implements a `MovieRepositoryInterface`) that's used by your services to fetch movies from database in your application.\n\nNow let's say that to unit test those services which depends on this `MovieRepository` you want to create an \"in-memory\" implmentation of the `MovieRepositoryInterface`.\n\nWith this small library you can easily do this:\n\n```php\n\u003c?php\n\nnamespace MyMovieApp\\Tests\\Repository\\InMemory;\n\nuse MyMovieApp\\Model\\Movie;\nuse MyMovieApp\\Repository\\MovieRepositoryInterface;\nuse Webgriffe\\InMemoryRepository\\ObjectRepository;\n\n/**\n * @extends ObjectRepository\u003carray-key,Movie\u003e\n */\nfinal class MovieRepository extends ObjectRepository implements MovieRepositoryInterface\n{\n}\n```\n\nAnd that's it! You have an \"in-memory\" implementation of the `MovieRepositoryInterface`.\nYou can use it in your tests as follows:\n\n```php\n$movieRepository = new \\MyMovieApp\\Tests\\Repository\\InMemory\\MovieRepository();\n$movieRepository-\u003eobjectCollection-\u003eadd(new Movie('Rambo'));\n$movieRepository-\u003eobjectCollection-\u003eadd(new Movie('Top Gun'));\n\n$this-\u003eassertCount(2, $movieRepository-\u003efindAll());\n$this-\u003eassertEquals(new Movie('Rambo'), $movieRepository-\u003efindOneBy(['title' =\u003e 'Rambo']));\n```\n\n## License\n\nThis plugin is under the MIT license. See the complete license in the LICENSE file.\n\n## Credits\n\nDeveloped by [Webgriffe®](https://www.webgriffe.com).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebgriffe%2Fin-memory-repository","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebgriffe%2Fin-memory-repository","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebgriffe%2Fin-memory-repository/lists"}