title: Use Trait, Interfaces or both?
body: <p>I have a question about using Trait and Interfaces in PHP.</p>
  
  <p>A trait with foobar function</p>
  
  <pre><code>&lt;?php
  
  trait FoobarTrait
  {
    protected $foobar;
  
    public function setFoobar($foobar)
    {
      $this-&gt;foobar = $foobar
    }
  
    public function getFoobar()
    {
      return $this-&gt;foobar;
    }
  }
  </code></pre>
  
  <p>The specific Interface to specify how to use Trait</p>
  
  <pre><code>&lt;?php
  
  interface FoobarInterface
  {
      public function setFoobar($foobar);
  
      public function getFoobar();
  }
  </code></pre>
  
  <p>I want use foobar feature in a class. What is the best way ?</p>
  
  <p>It is necessary to implements with an interface and specify trait or it is an induced behavior ?</p>
  
  <pre><code>&lt;?php
  
    class FoobarClass implements FoobarInterface
    {
      use FoobarTrait;
    }
  </code></pre>
  
  <p>Or this</p>
  
  <pre><code>&lt;?php
  
    class FoobarClass
    {
      use FoobarTrait;
    }
  </code></pre>
  
  <p>Thank's for your reply and debate ;)</p>