title: Dotenv\Dotenv::__construct() is not instance of Dotenv\Loader
body: <p>I am trying to build a Linkedin API code where I am finding a strange error </p>
  
  <pre><code>Fatal error: Uncaught TypeError: Argument 1 passed to Dotenv\Dotenv::__construct() must be an instance of Dotenv\Loader, string given, called in E:\xampp\htdocs\linkedinpi\examples\index.php on line 16 and defined in E:\xampp\htdocs\linkedinpi\vendor\vlucas\phpdotenv\src\Dotenv.php:31 Stack trace: #0 E:\xampp\htdocs\linkedinpi\examples\index.php(16): Dotenv\Dotenv-&gt;__construct('E:\\xampp\\htdocs...') #1 {main} thrown in E:\xampp\htdocs\linkedinpi\vendor\vlucas\phpdotenv\src\Dotenv.php on line 31
  </code></pre>
  
  <p>Which I am unable to replicate how to solve the issue.</p>
  
  <p>I have followed the steps for</p>
  
  <p><a href="https://github.com/zoonman/linkedin-api-php-client" rel="nofollow noreferrer">https://github.com/zoonman/linkedin-api-php-client</a>
  and 
  <a href="https://github.com/zoonman/linkedin-api-php-client/tree/master/examples" rel="nofollow noreferrer">https://github.com/zoonman/linkedin-api-php-client/tree/master/examples</a></p>
  
  <p>I already downloaded the Vendor by Composer and here is the code I have used</p>
  
  <pre><code>include_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor/autoload.php';
  
  
      use LinkedIn\Client;
      use LinkedIn\Scope;
  
  
      $dotenv = new Dotenv\Dotenv(dirname(__DIR__));
      $dotenv-&gt;load();
  
      session_start();
  
      $client = new Client(
          getenv('[LINKEDIN CLIENT ID]'),
          getenv('[LINKEDIN CLIENT SECRET]')
      );
  
  
      if (isset($_GET['code'])) { // we are returning back from LinkedIn with the code
          if (isset($_GET['state']) &amp;&amp;  // and state parameter in place
              isset($_SESSION['state']) &amp;&amp; // and we have have stored state
              $_GET['state'] === $_SESSION['state'] // and it is our request
          ) {
              try {
                  // you have to set initially used redirect url to be able
                  // to retrieve access token
                  $client-&gt;setRedirectUrl($_SESSION['redirect_url']);
                  // retrieve access token using code provided by LinkedIn
                  $accessToken = $client-&gt;getAccessToken($_GET['code']);
                  h1('Access token');
                  pp($accessToken); // print the access token content
                  h1('Profile');
                  // perform api call to get profile information
                  $profile = $client-&gt;get(
                      'people/~:(id,email-address,first-name,last-name)'
                  );
                  pp($profile); // print profile information
  
              $share = $client-&gt;post(
                  'people/~/shares',
                  [
                      'comment' =&gt; 'Checkout this amazing PHP SDK for LinkedIn!',
                      'content' =&gt; [
                          'title' =&gt; 'PHP Client for LinkedIn API',
                          'description' =&gt; 'OAuth 2 flow, composer Package',
                          'submitted-url' =&gt; 'https://github.com/zoonman/linkedin-api-php-client',
                          'submitted-image-url' =&gt; 'https://github.com/fluidicon.png',
                      ],
                      'visibility' =&gt; [
                          'code' =&gt; 'anyone'
                      ]
                  ]
              );
              pp($share);
  
  
              $companyId = '2414183';
  
              h1('Company information');
              $companyInfo = $client-&gt;get('companies/' . $companyId . ':(id,name,num-followers,description)');
              pp($companyInfo);
  
              h1('Sharing on company page');
              $companyShare = $client-&gt;post(
                  'companies/' . $companyId . '/shares',
                  [
                      'comment' =&gt;
                          sprintf(
                              '%s %s just tried this amazing PHP SDK for LinkedIn!',
                              $profile['firstName'],
                              $profile['lastName']
                          ),
                      'content' =&gt; [
                          'title' =&gt; 'PHP Client for LinkedIn API',
                          'description' =&gt; 'OAuth 2 flow, composer Package',
                          'submitted-url' =&gt; 'https://github.com/zoonman/linkedin-api-php-client',
                          'submitted-image-url' =&gt; 'https://github.com/fluidicon.png',
                      ],
                      'visibility' =&gt; [
                          'code' =&gt; 'anyone'
                      ]
                  ]
              );
              pp($companyShare);
  
  
  
              $filename = './demo.jpg';
              $client-&gt;setApiRoot('https://api.linkedin.com/');
              $mp = $client-&gt;upload($filename);
              */
          } catch (\LinkedIn\Exception $exception) {
              // in case of failure, provide with details
              pp($exception);
              pp($_SESSION);
          }
          echo '&lt;a href="/"&gt;Start over&lt;/a&gt;';
      } else {
  
          echo 'Invalid state!';
          pp($_GET);
          pp($_SESSION);
          echo '&lt;a href="/"&gt;Start over&lt;/a&gt;';
      }
  
  } elseif (isset($_GET['error'])) {
  
      pp($_GET);
      echo '&lt;a href="/"&gt;Start over&lt;/a&gt;';
  } else {
      // define desired list of scopes
      $scopes = [
          Scope::READ_BASIC_PROFILE,
          Scope::READ_EMAIL_ADDRESS,
          Scope::MANAGE_COMPANY,
          Scope::SHARING,
      ];
      $loginUrl = $client-&gt;getLoginUrl($scopes); 
      $_SESSION['state'] = $client-&gt;getState(); 
      $_SESSION['redirect_url'] = $client-&gt;getRedirectUrl(); 
      echo 'LoginUrl: &lt;a href="'.$loginUrl.'"&gt;' . $loginUrl. '&lt;/a&gt;';
  }
  
  
  function pp($anything)
  {
      echo '&lt;pre&gt;' . print_r($anything, true) . '&lt;/pre&gt;';
  }
  
  
  function h1($h) {
      echo '&lt;h1&gt;' . $h . '&lt;/h1&gt;';
  }
  </code></pre>