title: Getters and setters with magic PHP calls Laravel
body: <p>I'm not really experienced with PHP magic methods, and I'm trying to create implicit getters and setters that interact with Laravel framework. Now, I know there are accessors and mutators , but they have to be explicitly declared. What I would like is to make is some kind of implicit function instead of declaring them.
  I saw this done in Zend framework, it was something like</p>
  
  <pre><code>public function __call ($method, $params) {
  
      $property = strtolower($this-&gt;_getCamelCaseToUnderscoreFilter()-&gt;filter(substr($method, 3)));
  
      if (!property_exists($this, $property))
          return null;
      // Getters
      elseif (substr($method, 0, 3) == 'get')
      {
          return $this-&gt;$property;
      }
      // Setters
      elseif (substr($method, 0, 3) == 'set')
      {
          $this-&gt;$property = $params[0];
          return $this;
      }
      else
          return null;
  }
  </code></pre>
  
  <p>Now if I have a model with this function, I'll be able to do just <code>$model-&gt;getProperty()</code> or <code>$model-&gt;setProperty($property)</code>.
  But I'm not sure how can I apply it to Laravel. any idea?</p>