Currently we need to interface with a REST API. The only problem we have implementing this is choosing the right approach.Weve done this by using Resources  for example a Photo Resource that has certain methods to interface with the REST API. The only problem with this approach is that each time we use a certain Resource we need to inject an Http Client that is being used to perform that task.So every part of the application that wants to use a certain Resource need to have an extended knowledge of the Http Client. Is there a certain way to solve this problem without using a Singleton  as there is only one instance of the Http Client? Maybe a certain Design Pattern?For now we make usage of PHP to accomplish this task in combination with Guzzle Http; but this problem is more about Software Architecture.This is an example of our current implementation:class Photo{    /**      * @var Client $httpClient      */    private $httpClient;    public function __construct($httpClient)    {        $this->httpClient = $httpClient;    }    public function getByName($photoName)    {        # Use $httpClient    }}
Software Design, a fitting Design Pattern?
design patterns;php;architecture