title: PHP Reflection - Get Method Parameter Type As String
body: <p>I'm trying to use PHP reflection to dynamically load the class files of models automatically based upon the type of parameter that is in the controller method. Here's an example controller method.</p>
  
  <pre><code>&lt;?php
  
  class ExampleController
  {
      public function PostMaterial(SteelSlugModel $model)
      {
          //etc...
      }
  }
  </code></pre>
  
  <p>Here's what I have so far.</p>
  
  <pre><code>//Target the first parameter, as an example
  $param = new ReflectionParameter(array('ExampleController', 'PostMaterial'), 0);
  
  //Echo the type of the parameter
  echo $param-&gt;getClass()-&gt;name;
  </code></pre>
  
  <p>This works, and the output would be 'SteelSlugModel', as expected. However, there is the possibility that the class file of the model may not be loaded yet, and using getClass() requires that the class be defined - part of why I'm doing this is to autoload any models that a controller action may require.</p>
  
  <p>Is there a way to get the name of the parameter type without having to load the class file first?</p>