Closed a-tarhanov closed 3 years ago
You shoud check your guzzle version.
https://github.com/guzzle/guzzle/blob/6.5.5/src/Client.php#L26 https://github.com/guzzle/guzzle/blob/7.0.0/src/Client.php#L13
Unfortunately the example is incomplete or at least it assume that you know that now GuzzeleHttp\Client is on a different package.
After composer require raiym/instagram-php-scraper
you must run composer require guzzlehttp/guzzle
Argument 1 passed to InstagramScraper\Instagram::__construct() must be an instance of Psr\Http\Client\ClientInterface, instance of GuzzleHttp\Client given, called in
name : guzzlehttp/guzzle descrip. : Guzzle is a PHP HTTP client library keywords : client, curl, framework, http, http client, rest, web service versions : * 7.2.0 type : library license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText homepage : http://guzzlephp.org/ source : [git] https://github.com/guzzle/guzzle.git 0aa74dfb4d803a22d50e79 dist : [zip] https://api.github.com/repos/guzzle/guzzle/zipball/0aa74df22d50e79 0aa74dfb41**a22d50e79 path : /vendor/guzzlehttp/guzzle names : guzzlehttp/guzzle
autoload psr-4 GuzzleHttp\ => src/ files
requires ext-json * guzzlehttp/promises ^1.0 guzzlehttp/psr7 ^1.7.0 php >=5.5 symfony/polyfill-intl-idn ^1.17.0
requires (dev) ext-curl * phpunit/phpunit ^4.8.35 || ^5.7 || ^6.4 || ^7.0 psr/log ^1.1
doctrine/inflector 2.0.3 PHP Doctrine Inflector is a small library that can perform string manipulati... doctrine/instantiator 1.3.1 A small, lightweight utility to instantiate objects in PHP without invoking ... guzzlehttp/guzzle 7.2.0 Guzzle is a PHP HTTP client library guzzlehttp/promises v1.3.1 Guzzle promises library guzzlehttp/psr7 1.7.0 PSR-7 message implementation that also provides common utility methods illuminate/contracts v6.18.35 The Illuminate Contracts package. illuminate/support v6.18.35 The Illuminate Support package. irazasyed/telegram-bot-sdk v3.1.0 The Unofficial Telegram Bot API PHP SDK league/event 2.2.0 Event package mashape/unirest-php v3.0.4 Unirest PHP myclabs/deep-copy 1.10.1 Create deep copies (clones) of your objects nesbot/carbon 2.38.0 An API extension for DateTime that supports 281 different languages. paragonie/random_compat v9.99.99 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7 phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect the code structure phpdocumentor/reflection-docblock 5.2.0 With this component, a library can provide support for annotations via DocBl... phpdocumentor/type-resolver 1.3.0 A PSR-5 based resolver of Class names, Types and Structural Element Names phpfastcache/phpfastcache 7.1.1 PHP Abstract Cache Class - Reduce your database call using cache system. Php... phpspec/prophecy v1.10.3 Highly opinionated mocking framework for PHP 5.3+ phpunit/php-code-coverage 4.0.8 Library that provides collection, processing, and rendering functionality fo... phpunit/php-file-iterator 1.4.5 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-text-template 1.2.1 Simple template engine. phpunit/php-timer 1.0.9 Utility class for timing phpunit/php-token-stream 2.0.2 Wrapper around PHP's tokenizer extension. phpunit/phpunit 5.5.7 The PHP Unit Testing framework. phpunit/phpunit-mock-objects 3.4.4 Mock Object library for PHPUnit psr/cache 1.0.1 Common interface for caching libraries psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11) psr/http-client 1.0.1 Common interface for HTTP clients psr/http-message 1.0.1 Common interface for HTTP messages psr/simple-cache 1.0.1 Common interfaces for simple caching raiym/instagram-php-scraper v0.10.0 Instagram PHP Scraper. Get account information, photos and videos without an... ralouphie/getallheaders 3.0.3 A polyfill for getallheaders. sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code belongs to sebastian/comparator 1.2.4 Provides the functionality to compare PHP values for equality sebastian/diff 1.4.3 Diff implementation sebastian/environment 2.0.0 Provides functionality to handle HHVM/PHP environments sebastian/exporter 1.2.2 Provides the functionality to export PHP variables for visualization sebastian/global-state 1.1.1 Snapshotting of global state sebastian/object-enumerator 1.0.0 Traverses array structures and object graphs to enumerate all referenced obj... sebastian/recursion-context 1.0.5 Provides functionality to recursively process PHP variables sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on resources sebastian/version 2.0.1 Library that helps with managing the version number of Git-hosted PHP projects symfony/polyfill-ctype v1.18.1 Symfony polyfill for ctype functions symfony/polyfill-intl-idn v1.18.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.18.1 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.18.1 Symfony polyfill for the Mbstring extension symfony/polyfill-php70 v1.18.1 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions symfony/polyfill-php72 v1.18.1 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/translation v4.4.11 Symfony Translation Component symfony/translation-contracts v1.1.9 Generic abstractions related to translation symfony/yaml v3.4.43 Symfony Yaml Component webmozart/assert 1.9.1 Assertions to validate method input/output with nice error messages.
$instagram = Instagram::withCredentials(new \GuzzleHttp\Client(), $login, $password, $cache); $instagram->login(); $instagram->saveSession();
Argument 1 passed to InstagramScraper\Instagram::withCredentials() must be an instance of Psr\Http\Client\ClientInterface, instance of GuzzleHttp\Client given
У тебя работает?
You shoud check your guzzle version.
https://github.com/guzzle/guzzle/blob/6.5.5/src/Client.php#L26 https://github.com/guzzle/guzzle/blob/7.0.0/src/Client.php#L13
Обновил, не помогло.
Unfortunately the example is incomplete or at least it assume that you know that now GuzzeleHttp\Client is on a different package.
After
composer require raiym/instagram-php-scraper
you must run
composer require guzzlehttp/guzzle
Не помогло! Что сделал не так?
If your Guzzle version is not compliant, you can use a simple wrapper class like this:
<?php declare(strict_types=1);
namespace XYZ;
/**
* Empty subclass to fulfill interfaace requirements of the Instagram scraper
*/
class Client extends \GuzzleHttp\Client implements \Psr\Http\Client\ClientInterface
{
/**
* @inheritDoc
*/
public function sendRequest(\Psr\Http\Message\RequestInterface $request): \Psr\Http\Message\ResponseInterface
{
return $this->send($request);
}
}
I have the same problem,
Expected parameter of type 'Psr\Http\Client\ClientInterface', 'GuzzleHttp\Client' provided
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Argument 1 passed to Symfony\Component\Cache\Adapter\Psr16Adapter::__construct() must be an instance of Psr\SimpleCache\CacheInterface, string given, called in C:\Users\ITS-8\Desktop\SMDP\app\Http\Controllers\TagController.php on line 19
i have same issue
$instagram = Instagram::withCredentials(new \GuzzleHttp\Client(), $login, $password, $cache); $instagram->login(); $instagram->saveSession();
Argument 1 passed to InstagramScraper\Instagram::withCredentials() must be an instance of Psr\Http\Client\ClientInterface, instance of GuzzleHttp\Client given