dirkgroenen / pinterest-api-php

A PHP wrapper for the official Pinterest API. :pushpin:
https://developers.pinterest.com/docs/getting-started/introduction/
Apache License 2.0
173 stars 76 forks source link

Class 'Dotenv\Dotenv' not found #50

Closed samphors closed 8 years ago

samphors commented 8 years ago

I have not started yet with the code insider, after get the file downloaded via composer and put it my local server "xampp", I got this error : Fatal error: Class 'Dotenv\Dotenv' not found in C:\xampp\htdocs\pinterst_fancybox\demo\boot.php on line 8

dirkgroenen commented 8 years ago

Sounds like the DotEnv package didn't install itself. You sure you've installed with dev-requirements (which should be default)?

samphors commented 8 years ago

This is what I got from composer Link

And I got this error Link

I found this in the boot.php

<?php
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    require "../vendor/autoload.php";
    $dotenv = new Dotenv\Dotenv(__DIR__);
    $dotenv->load();
    $pinterest = new DirkGroenen\Pinterest\Pinterest(getenv("APP_ID"), getenv("APP_SECRET"));
    if (isset($_GET["code"])) {
        $token = $pinterest->auth->getOAuthToken($_GET["code"]);
        $pinterest->auth->setOAuthToken($token->access_token);
        setcookie("access_token", $token->access_token);
    } else if (isset($_GET["access_token"])) {
        $pinterest->auth->setOAuthToken($_GET["access_token"]);
    } else if (isset($_COOKIE["access_token"])) {
        $pinterest->auth->setOAuthToken($_COOKIE["access_token"]);
    } else {
        assert(false);
    }
?>

Where is the vendor folder ?

dirkgroenen commented 8 years ago

Please read into Composer. The vendor directory is created by composer after using it to install the package.

If you don't want to use composer you can find an autoload script in the root of the project. (Note: it doesn't include Dotenv).

jbuitrago commented 6 years ago

Hi,I have these this problem :+1:

Fatal error: Uncaught Error: Class 'DirkGroenen\Pinterest\Pinterest' not found in C:\wamp64_2\www\pinterest\index.php on line 5 Error: Class 'DirkGroenen\Pinterest\Pinterest' not found in C:\wamp64_2\www\pinterest\index.php on line 5

└───vendor ├───composer └───dirkgroenen └───pinterest-api-php ├───demo ├───src │ └───Pinterest │ ├───Auth │ ├───Endpoints │ ├───Exceptions │ ├───Models │ ├───Transport │ └───Utils └───tests └───Pinterest ├───Endpoints ├───Models ├───responses │ ├───BoardsTest │ ├───CollectionTest │ ├───FollowingTest │ ├───ModelTest │ ├───PinsTest │ └───UsersTest └───Utils