The Sourcerer is a library to combine several sources for fetching resources in a centralized manner.
A repository is a central point of access of persisted objects, coming from different sources
//Init a list of sources that implement Vacancy\Source
$sources = [$mysqlSource, $apiSource];
$repository = new Repository($sources);
//Use the repository to fetch a resource
$object = $repository->find(1);
You can create a repository configured with several sources but you can restrict the sources to use for a particular fetch
//Have a repository with some registered sources
$repository = new Repository($sources);
//Use the repository to fetch a resource from a source called 'api'
$object = $repository->using('api')->find(1);
//Initialize a source with an implementation of a Vacancy\Cache\CacheProvider
$cacheSource = new CacheSource($redisCache, new ApiSource())
$sources = [$cacheSource];
$repository = new Repository($sources);
//Use the repository to fetch a resource
$object = $repository->find(1);