Need help with persisted-objects?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

127 Stars 14 Forks 40 Commits 1 Opened issues


Stupid PHP library to do very simple persistance for test automation purposes

Services available


Need anything else?

Contributors list

Persisted Objects

This repository is a collection of repositories (pun intended) that somebody might find useful in training or testing exercises. They provide an easy way to create Fakes for your repositories in the test infrastructure.


As stated in the header - for testing and demo purposes. These repos are optimised for cases where you have less than 20 records in your repository and there's always only one user accessing it at a time. In these particular cases these repositories are faster. But in every other instance they're exponentially not.


Install with:

$> composer require --dev everzet/persisted-objects

Use like this:

$repo = new FileRepository(TEMP_FILE, new AccessorObjectIdentifier('getId'));

$user === $repo->findById($user->getId());


or like this:

$repo = new InMemoryRepository(new CallbackObjectIdentifier(
    function($obj) { return $obj->getFirstname() . $obj->getLastname(); }

$user === $repo->findById($user->getFirstname() . $user->getLastname());


We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.