In Polavi application, service is an object that does something. Below are something we need to know about services

  • They are located at <module folder>/Services
  • They can be registered in services.php file of each module
  • Normally they will be injected by using dependency injection and only be initialized when called. And they are singleton.

Here is an example how we register a services

$container[\Polavi\Module\Graphql\Services\QueryType::class] = function() use ($container){
return new \Polavi\Module\Graphql\Services\QueryType($container);

And this example show how to call a service