How to access parameters in resolving method passed in resolve helper

PHP API Reflection allows you to get some informations about a class constructor, such as parameters name, type, etc… but it does not allow to know the arguments passed to an instance of this class. Though, you could easily retrieve them from resolving method with this way


class Game
    protected $param1;

    protected $param2;

    public function __construct($param1, $param2)
        $this->param1 = $param1;
        $this->param2 = $param2;

    public function getParam1()
        return $this->param1;

    public function getParam2()
        return $this->param2;
$this->app->resolving(Game::class, function (Game $game, $app){
    $param1 = $game->getParam1();
    $param2 = $game->getParam2();

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top