title: Laravel 4 One interface with multiple implementations at same time
body: <p>Problem is that i don't know how to bind multitple implementations of one interface.</p>
  
  <p>Example:</p>
  
  <pre><code>// One interface
  interface SmsInterface {
  ...
  }
  
  // First implementation using SmsCoin
  class SmscoinAPI implements SmsInterface {
  ...
  }
  
  
  // Second implementation using Fortumo
  class FortumoAPI implements SmsInterface {
  ...
  }
  </code></pre>
  
  <p>// Two controllers:</p>
  
  <pre><code>class SmsCoinController {
      public function __construct(SmsInterface $sms) {
          $this-&gt;sms = $sms
      }
  }
  
  class FortumoController {
      public function __construct(SmsInterface $sms) {
          $this-&gt;sms = $sms
      }
  }
  </code></pre>
  
  <ol>
  <li><p>Question: How I can bind SmsInterface with implementation FortumoApi for FortumoController, and bind SmsInterface with implementation SmsCoinApi for SmsCoinController ?</p></li>
  <li><p>I was using ServiceProvider for registering bindings, can I do it there ? If not where should bindings put?</p></li>
  </ol>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I can't get answer anywhere, read many laravel books, everywhere is said to use multiple implementations, but nowhere is shown how to swap/switch those implementations.</p>
  
  <p>If i have one interface and two implementations, how to bind and swap them in controller. Do i need to do that in that controller constructor method ? or in routes by checking controller's route or in filters.php ? or in Service provider ? and how to technically correclty write that code ?</p>