Closed Josh-123 closed 6 years ago
did you run composer with config.php and credentials filled out? your folder structure should have:
vendor composer.json composer.lock config.php
and in your php file: ` include 'config.php';
use mrteye\Gdax\Api as Api; use mrteye\Gdax\Auth as Auth; // rest of code ...`
I am not sure if I am running composer correctly.
From terminal I ran again composer require mrteye/gdax I didn't see vendor or composer.lock
So I navigated to that directory and ran the command again, still I don't see those dir and files I got this message after running: Joshuas-MacBook-Pro:mrteyeGDAX josh$ composer require mrteye/gdax Using version ^1.2 for mrteye/gdax ./composer.json has been updated Root package 'mrteye/gdax' cannot require itself in its composer.json Did you accidentally name your root package after an external package?
this was the first step:
Copy the config.php.example file to config.php and place it in your document root. Add credentials for private API calls.
then From terminal run composer require mrteye/gdax
Yes I did that as the first step
I have config.php with credentials
then maybe this part is not getting the propper path?
// Setup; All tests should be one level below doc root. if (! $docRoot = $_SERVER['DOCUMENT_ROOT']) { $docRoot = dirname(dirname(__FILE__)); }
echo $docRoot;
require_once "$docRoot/vendor/autoload.php";
require "$docRoot/config.php";
can you echo
out the path to verify thats where these files reside?
Am I running the composer right? I still don't have vendor directory. The test script I ran by creating a index.php in the installation directory. I tried running the index.php inside test directory but I got errors as I don't have vendor dir.
that test directory wont work, compser has to create that dir vendor
and a json file.
can you run composer --version
from terminal, what do you see?
Composer version 1.7-dev (3c09c0ab2a4b1acc13807fb7ff012a18d67a3a38) 2018-02-08 19:46:07
i have version 1.6.3, curious if theres something about dev.
I ran this composer remove mrteye/gdax and now I am seeing vendor dir! I am going to re run require and see what happens
I ran composer require and got this message
Joshuas-MacBook-Pro:mrteyeGDAX josh$ composer require mrteye/gdax Using version ^1.2 for mrteye/gdax ./composer.json has been updated Root package 'mrteye/gdax' cannot require itself in its composer.json Did you accidentally name your root package after an external package?
When I run the example #1 I get this error Fatal error: Uncaught Error: Class 'mrteye\Gdax\Api' not found in /Users/josh/Sites/bot/mrteyeGDAX/index.php:6 Stack trace: #0 {main} thrown in /Users/josh/Sites/bot/mrteyeGDAX/index.php on line 6
It looks like you are trying to require mrteye/gdax twice. Where is the working directory you mentioned?
If you see vendor...you probably do not need to run composer require anymore...Inside vendor should be mrteye/gdax. From there you could create the config.php and run the example in vendor/mrteye/gdax/test.
I got it to work. I had to run composer from outside the directory
Now when I run index.php inside test dir, I see the output but in three places I see Invalid API Key.
I have entered the API keys correctly.
Nice work. And thanks for trying out the API.
My guess is you are using the wrong API key. Are you using a key from sandbox or production, and does that pair with the server in the config file?
API key is from production. Not sure how to get API key for sandbox.
I got it working! Thanks a lot for all your help!
I am new to this and just getting started. I am on a Mac, enabled Apache, PHP and installed MySQL. Installed composer (version 1.7-dev). Ran composer require mrteye/gdax without errors.
Added dir mrteyeGDAX (with its contents) to the working dir. Updated config.php file name and added api credentials.
Created index.php inside mrteyeGDAX dir and pasted Examples #1 code. I am getting the following errors
Fatal error: Uncaught Error: Class 'mrteye\Gdax\Api' not found in /Users/josh/Sites/bot/mrteyeGDAX/index.php:6 Stack trace: #0 {main} thrown in /Users/josh/Sites/bot/mrteyeGDAX/index.php on line 6
What am I doing wrong? Thanks