Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having an issue with GuzzleHTTP #5

Open
ghost opened this issue Dec 26, 2020 · 4 comments
Open

Having an issue with GuzzleHTTP #5

ghost opened this issue Dec 26, 2020 · 4 comments

Comments

@ghost
Copy link

ghost commented Dec 26, 2020

Hello, i'm getting an error when i use this client.

Uncaught Error: Class 'GuzzleHttp\Client' not found in C:\xampp\htdocs\crypto\coingecko_client\src\CoinGeckoClient.php:39

Please help me to solve this
Thank you

@codenix-sv
Copy link
Owner

Hello, please install package by composer I hope this helped solve your problem.

@ghost
Copy link
Author

ghost commented Dec 26, 2020

Still i'm facing the same issue...

@codenix-sv
Copy link
Owner

Are you using autoloading?

https://getcomposer.org/doc/01-basic-usage.md#autoloading

@philip
Copy link

philip commented May 5, 2021

Sounds like you're wanting to use this as a standalone package (not integrated in your own project) and here's one simple way to do that (examples are geared towards macOS/Linux users but hopefully demonstrate the general idea for Windows too):

  1. Create a new directory and cd into it e.g.,
    mkdir somedir && cd somedir

  2. Create an empty object composer.json file e.g.,
    echo "{}" > composer.json

  3. Now install it using composer e.g.,
    composer require codenix-sv/coingecko-api

  4. Create a new file that uses autoloading e.g.,
    echo "<?php require 'vendor/autoload.php';" > test.php

  5. Now, under that, execute some code... but ensure your require vendor/autoload.php is present first as it magically loads the appropriate classes e.g.,

<?php
require 'vendor/autoload.php';

use Codenixsv\CoinGeckoApi\CoinGeckoClient;

$client = new CoinGeckoClient();
$data = $client->ping();
print_r($data);

Hopefully the output is:

Array
(
    [gecko_says] => (V3) To the Moon!
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants