I have a base class:
class BaseAPI { public function __construct(Client $client, CacheInterface $cache, $apiBaseUri) { $this->client = $client; $this->apiBaseUri = $apiBaseUri; $this->cache = $cache; } }
And then in the provider:
class APIServiceProvider extends ServiceProvider { public function register() { $this->app ->when(BaseAPI::class) ->needs('$apiBaseUri') ->give(env('DEFAULT_API_URI','')); } }
It works. But when I do the ancestor:
class GetLocations extends BaseAPI { protected $apiMethodName = 'locations'; protected $type = 'get'; }
I get an error. Of course, I can manually write code for each of the ancestors, but there are many of them, so the question is: is there any inheritance mechanism for binding? Something like this: https://symfony.com/doc/current/service_container/parent_services.html
source share