title: How does Reflection in Laravel work?
body: <p>How does reflection in Laravel actually work?</p>
  
  <p>I tried to debug it to see how Laravel uses reflection in a controller's constructor or methods to resolve their dependencies and sub-dependencies and then and give it back to us.</p>
  
  <p>But I found it hard, and it's very complicated to see and to even understand 50% of. Jumping from class to class, I can't really see it. I tried a few times by debugging it with low results of understanding.</p>
  
  <p>I am very impressed by this and by reflection, and the way Laravel uses it makes my heart burn—it's just beautiful. And I wish to fully understand that—the whole process—in general, and step by step.</p>
  
  <p>Beginning from hitting the route to finally having, let's say, <code>dd($x)</code>, where <code>$x</code> is from a method argument and is a <code>TestClass</code> that has another dependency of <code>TestClass2</code> that should be constructed through: <code>$x = new TestClass(new TestClass2());</code></p>
  
  <p>I think those are beautiful mechanics and architecture, and understanding this is something I want so badly.</p>
  
  <p>So again, my question is: how does reflection in Laravel actually work?</p>
  
  <hr>
  
  <p>It's not about <code>dd</code> guys... Let's say without <code>dd</code>. Just as I said earlier - when we have this object instantiated from the <code>class method</code>. It's not about dumping it, it's just about having it from <code>method injection</code> by <code>reflection</code>.</p>
  
  <p>The <code>dd</code> was only an example. It can even be <code>die(var_dump());</code> and it will work</p>