App\Action
, then your directory should be named like this: src/Action/
and not src/action/
.
Hi. I have this problem, when I upload my project to a host this error activates me: Fatal error: Not captured DI \ NotFoundException: No entry or class was found for 'App \ Controllers \ AuthController' in /home/vrfctuqw/myhonsting.com/ vendor /php-di/php-di/src/Container.php:135 Stack tracking: # 0 /home/vrfctuqw/myhosting.com/vendor/php-di/php-di/src/CompiledContainer.php(64) : DI \ Container-> get ('App \ Controllers ...') # 1 /home/vrfctuqw/myhosting.com/public/index.php(474): DI \ CompiledContainer-> get ('App \ \ Controllers ... ') # 2 {main} included in /home/vrfctuqw/myhosting.com/vendor/php-di/php-di/src/Container.php on line 135
Locally it works correctly, but in hosting I present this. I would like you to help me please
composer update
I get a notice that the package jeremeamia/superclosure is abandoned and php-di seems to require/depend on this package. Any solutions to this problem especially that the recommendation is using opis/closure and it's not advisable to edit composer.lock directly??
use ($var)
in a closure, but took those out
Hey all! I'm wondering if I can look up a key within a get()
'd array in a autowire()->constructorParameter()
somehow. This was my first stab, and I understand it doesn't work because get()
is a definition helper, not an immediate lookup:
return [
'config' => [
'foo' => 'bar'
],
'my.object' => autowire( MyClass::class )
->constructorParameter( 'foo', get( 'config' )[ 'foo' ] )
]
I understand that I could do this with a factory function, but I'm really curious as to if there is a way to do so without one?
I tried something like this:
class CacheServiceProvider implements ServiceProviderInterface
{
/**
* @param Container $pimple
*/
public function register(Container $pimple): void
{
$pimple[CacheAdapter::class] = [self::class, 'getCache'];
}
Hey guys, I've quick question as I do not understand it from docs.
How does @Inject work? It is said, that I can use it while I do not have control over object creation (i.e. some package).
The Object is created "by hand" somewhere (new Object(itsparams)) - then, I would like to inject some properties from container
factory(function($container){
return (new MyServiceFactory)->__invoke($container);
}),