I feel that I searched the entire Internet through and through, but it may not seem that this is visible. I am using Silex (latest version) and cannot figure out how to use Silex ServiceProvider to return an instance of the class to use.
I know how to create a basic service provider.
What I do not know how to do is how to get this service provider to use its own class. I tried everything that I could think of or find on the Internet. Part of the problem is that the Silex documentation on this question is not very extensive, and most of the questions asked about this type of problem were asked / answered before quite large changes were made to how it was done (or so it seems) the answers are not current.
So put it briefly: I want to use a system like Silex $ app ['myclass'] to access my class so that I can do something like $ app ['myclass'] → myMethod ().
Where I hung up is that although I can create a service provider, I cannot figure out how to get the service provider to recognize the class. I tried the whole namespace theme with pso-0 composer autoload setting and tried using things like MyClass / MyClass.
Haha, mainly because there is so little documentation, maybe some part of it that I'm doing wrong.
Does anyone write a current step-by-step process for connecting a custom library / class to the $ app variable? I think this will help not only me, but also others. Thanks!
source share