Answers.Body: <p><a href="https://github.com/mailin-api/mailin-api-php/blob/master/src/Sendinblue/Mailin.php" rel="nofollow noreferrer">Looks like</a> you're missing the proper namespace.</p>
  
  <p>Should be:</p>
  
  <pre><code>$mailin = new \Sendinblue\Mailin('https://api.sendinblue.com/v2.0', 'dqsdsapicode', 5000);
  </code></pre>
  
  <p>And here also is the other syntax for a global call in the controller.<br>
  Controller beginning would be:</p>
  
  <pre><code>&lt;?php
  namespace Craft;
  
  use Sendinblue\Mailin;
  
  class FooController extends BaseController
  </code></pre>
  
  <p>Then class call will be:</p>
  
  <pre><code>$mailin = new Mailin('https://api.sendinblue.com/v2.0', 'dqsdsapicode', 5000);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-07T00:17:50.780Z
Answers.LastActivityDate: 2016-12-07T14:19:06.470Z
Answers.LastEditDate: 2016-12-07T14:19:06.470Z
Answers.UserDisplayName: Brad Bell
Body: <p>I am trying to integrate with <code>sendinblue API</code> and I installed it with <a href="https://github.com/mailin-api/mailin-api-php" rel="nofollow noreferrer">composer</a> as a third party library.<br>
  But it still does not work:<br>
  <code>Fatal error: Class 'Mailin' not found in /localfolder/www/craft/plugins/stepsprogram/controllers/StepsProgramController.php on line 225</code></p>
  
  <p>Here is the <code>composer.json</code> file at the root of my plugin:</p>
  
  <pre><code>{
      "name": "/stepsprogram",
      "description": "Steps Program.",
      "type": "craft-plugin",
      "require": {
          "composer/installers": "~1.0",
          "mailin-api/mailin-api-php": "^1.0"
      }
  }
  </code></pre>
  
  <p>The <code>init</code> function of my plugin: </p>
  
  <pre><code>public function init()
  {
      // If using composer
      require_once __DIR__ . '/vendor/autoload.php';
  }
  </code></pre>
  
  <p>And the error happen here when trying to call the <code>mailin</code> class in my controller:  </p>
  
  <pre><code>        $mailin = new \Mailin('https://api.sendinblue.com/v2.0', 'dqsdsapicode', 5000);    //Optional parameter: Timeout in MS
          var_dump($mailin-&gt;get_account());
  </code></pre>
  
Tags: <plugin-development>
Title: Plugin dev with Sendinblue mailer integration
ThreadText: # Plugin dev with Sendinblue mailer integration
  
  (Asked by: username_0 on 2016-12-06)
  
  I am trying to integrate with `sendinblue API` and I installed it with [composer](https://github.com/mailin-api/mailin-api-php) as a third party library.  
  But it still does not work:  
  `Fatal error: Class 'Mailin' not found in /localfolder/www/craft/plugins/stepsprogram/controllers/StepsProgramController.php on line 225`
  
  Here is the `composer.json` file at the root of my plugin:
  
  ```
  {
      "name": "/stepsprogram",
      "description": "Steps Program.",
      "type": "craft-plugin",
      "require": {
          "composer/installers": "~1.0",
          "mailin-api/mailin-api-php": "^1.0"
      }
  }
  
  ```
  
  The `init` function of my plugin:
  
  ```
  public function init()
  {
      // If using composer
      require_once __DIR__ . '/vendor/autoload.php';
  }
  
  ```
  
  And the error happen here when trying to call the `mailin` class in my controller:
  
  ```
          $mailin = new \Mailin('https://api.sendinblue.com/v2.0', 'dqsdsapicode', 5000);    //Optional parameter: Timeout in MS
          var_dump($mailin->get_account());
  
  ```
  
  **Tags:** plugin-development
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-12-07. Score: 2 | Accepted answer
  
  [Looks like](https://github.com/mailin-api/mailin-api-php/blob/master/src/Sendinblue/Mailin.php) you're missing the proper namespace.
  
  Should be:
  
  ```
  $mailin = new \Sendinblue\Mailin('https://api.sendinblue.com/v2.0', 'dqsdsapicode', 5000);
  
  ```
  
  And here also is the other syntax for a global call in the controller.  
  Controller beginning would be:
  
  ```
  <?php
  namespace Craft;
  
  use Sendinblue\Mailin;
  
  class FooController extends BaseController
  
  ```
  
  Then class call will be:
  
  ```
  $mailin = new Mailin('https://api.sendinblue.com/v2.0', 'dqsdsapicode', 5000);
  
  ```
  
  
  ---
  
  