title: Understanding Symfony2 services
body: <p>I'm quite new to Symfony 2 and I'm moving to advanced topics like <a href="http://symfony.com/doc/2.0/book/service_container.html" rel="nofollow">services</a>. When should an object be a service?</p>
  
  <p>For example, say that you have a facade object for making a call to a REST service. This class needs a username and password. Would it be correct modeling that class as a global service? Even if it's used only in a portion of the whole project?</p>
  
  <pre><code># app/config/config.yml
  parameters:
      my_proxy.username:  username
      my_proxy.password:  password
  
  services:
      my_proxy:
          class:        Acme\TestBundle\MyProxy
          arguments:    [%my_proxy.username%, %my_proxy.password%]
  </code></pre>