Questions tagged [service-provider]

380 questions
0
votes
0 answers

Java 9 Module / Service System - get an instanced service provider by name, or a new one if none exists?

I am trying to learn about the Java 9 Services, so this is might not be an ideal scenario but what I am using to try to learn services, specifically... I am trying to create a service for DatabaseConnection classes. There might be a provider for…
Wige
  • 3,788
  • 8
  • 37
  • 58
0
votes
1 answer

Laravel Service Provider: new class with params

is it possible to pass parameters to a class inside app()->make in bind? // MyServiceProvider.php (extends ServiceProvider) $this->app->bind('MyService', function ($app) { return new MyService( $app->make('Carbon'), …
Ar3s
  • 1
  • 1
0
votes
0 answers

Laravel Service Providers - Using Multiple Configurations

In this example, I am trying to configure a package through a service provider for 2 separate account connections to Xero. In the service provider: public function register() { // Merge defaults $this->mergeConfigFrom( …
Adam Lambert
  • 1,311
  • 3
  • 24
  • 45
0
votes
1 answer

ServiceProvider with a singleton asking for primitive types in controller method DI

I'm trying to create ServiceProvider for duplicated code in my Laravel application. My solution throws an exception: Illuminate \ Contracts \ Container \ BindingResolutionException: Unresolvable dependency resolving [Parameter #0 [
Marek
  • 1
  • 5
0
votes
1 answer

SimpleSAMLphp setup and SP metadata

I'm new to SAML 2.0 as well as SimpleSAMLphp. I have couple questions regarding to setup and metadata configuration. I act as a SP and I need to configure metadata that will be sent to my IdP. The IdP has some specific configuration requirements.…
0
votes
1 answer

Using Laravel Package Classes Into Another

I created a simple Laravel package that I have already deployed to GitHub and Packagist successfully. It can be installed via Composer as expected. Now... I am creating a second package that would use the first one's functionality, but it is not…
PHPer
  • 637
  • 4
  • 19
0
votes
1 answer

add new object in IOC container without having to specify every consturctor param

I'm trying to add a class to my scoped service in .net core 2.1, I don't want a provider to get all the services needed to satisfy the params of the constructor. Is there an easier way to do this? services.AddScoped((provider) => …
Vincent
  • 1,497
  • 1
  • 21
  • 44
0
votes
1 answer

Overriding Mailer service in Laravel 5.4

I am trying to override the default implementation of Mailer in Illuminate\Mail\MailServiceProvider. At first, I thought that I will just extend the service and switch the implementation in the container followingly: App\Mail\Mailer
Jan Richter
  • 1,976
  • 4
  • 29
  • 49
0
votes
0 answers

Bind same controller from multiple Service Providers, with different parameters

I am creating various Laravel packages, each with their own Service Provider. A lot of them will need to a bind a Controller from another package I made, but call it with unique parameters. The issue I'm getting is that, even with the bind in the…
Mr Pablo
  • 4,109
  • 8
  • 51
  • 104
0
votes
1 answer

How to provide IServiceProvider as a dependency when you do instances in DI manually?

Context I have 5 services: Service1 (no depends.) Service2 (no depends.) Service3 (Service1, Service2, IServiceProvider) : ISpecialService Service4 (Service1, Service2, Service3) : ISpecialService Service5 (Service1, Service3, Service4) :…
KreonZZ
  • 175
  • 2
  • 10
0
votes
0 answers

Angular 4 Multiple Providers

In my Module I want to insert multiple providers. But I lose the window provider when adding the APP_INITIALIZER service = providers: [ AlertService, ConfigurationService, LocalStoreManager, …
RenleyRenfield
  • 311
  • 1
  • 3
  • 15
0
votes
1 answer

Laravel Target is not instantiable while building

I created an Artisan command which worked and where I injected a Kafka client service as the first parameter and a concrete class BudgetsTransformer, as the second parameter. class ConsumeBudgetsCommand extends Command { public function…
Averias
  • 931
  • 1
  • 11
  • 20
0
votes
1 answer

Laravel Service Provider Class Not Found

I am using Laravel 5.4 I am creating a Service Provider just for testing. My goal is create an instance of my TestClass and make it say Hello World in a Test Controller. I have successfully registered my service provider, but when I try to…
user908759
  • 1,355
  • 8
  • 26
  • 48
0
votes
0 answers

Investigating why should we use Service Providers and Service Containers to load a new library/class in Laravel? (Why not an easier way?)

I do have ready the topics in the documentation, but please help me to know why this is the most correct way and what's wrong (and not enough) with methods like $this->load->model('User_model') or setting the /config/autoload.php configs in…
Mohammad Naji
  • 5,372
  • 10
  • 54
  • 79
0
votes
1 answer

Share variable through ViewComposer and Middleware

I have an admins array as a variable which is now declared in ViewComposer. However, now I want to use the same variable in middlewares too. Where is the best way to place a variable so I can share it through other files? What I mean by…
senty
  • 12,385
  • 28
  • 130
  • 260