title: CakePHP - Cannot redeclare class
body: <p>I have a simple class that I've added to the components folder called mixpanel.php.  Within the file is:</p>
  
  <pre><code>&lt;?php
  class MetricsTracker {
      public $token;
      public $host = 'http://api.mixpanel.com/';
      public function __construct($token_string) {
          $this-&gt;token = $token_string;
      }
      function track($event, $properties=array()) {
          $params = array(
              'event' =&gt; $event,
              'properties' =&gt; $properties
              );
  
          if (!isset($params['properties']['token'])){
              $params['properties']['token'] = $this-&gt;token;
          }
          $url = $this-&gt;host . 'track/?data=' . base64_encode(json_encode($params));
          //you still need to run as a background process
          exec("curl '" . $url . "' &gt;/dev/null 2&gt;&amp;1 &amp;"); 
      }
  }
  ?&gt;
  </code></pre>
  
  <p>In users_controller.php I do:</p>
  
  <pre><code>require 'components/mixpanel.php';
  </code></pre>
  
  <p>however I'm getting an error:</p>
  
  <p>Fatal error: Cannot redeclare class MetricsTracker in /Users/Hooman/Sites/askedout/app/controllers/components/mixpanel.php on line 11</p>
  
  <p>Why is this happening? I do the same thing with a different php class and it works fine. This is very odd to me as I am not repeating the require definition anywhere. Please help, thanks.</p>