google-api-php-clientのgithubのcomposer.jsonをコピペして、コマンドプロンプトでcomposer require google/apiclient:"^2.0"を実行したのですが、以下のエラーが出ました。
どうすればインストールできますか?
C:\Users\UserName>composer require google/apiclient:"^2.0" ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - The requested package google/apiclient No version set (parsed as 1.0.0) is satisfiable by google/apiclient[No version set (parsed as 1.0.0)] but these conflict with your requirements or minimum-stability. Installation failed, reverting ./composer.json to its original content.
環境
windows10 64bit
Composer version: 1.7.2
PHP version: 7.2.10
追記
composer updateを実行したら以下のようになりました。
Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 41 installs, 0 updates, 1 removal - Removing abraham/twitteroauth (0.9.2) - Installing symfony/polyfill-ctype (v1.10.0): Downloading (100%) - Installing symfony/yaml (v3.4.17): Downloading (100%) - Installing sebastian/version (1.0.6): Downloading (100%) - Installing sebastian/global-state (1.1.1): Downloading (100%) - Installing sebastian/recursion-context (1.0.5): Downloading (100%) - Installing sebastian/exporter (1.2.2): Downloading (100%) - Installing sebastian/environment (1.3.8): Downloading (100%) - Installing sebastian/diff (1.4.3): Downloading (100%) - Installing sebastian/comparator (1.2.4): Downloading (100%) - Installing doctrine/instantiator (1.1.0): Downloading (100%) - Installing phpunit/php-text-template (1.2.1): Downloading (100%) - Installing phpunit/phpunit-mock-objects (2.3.8): Downloading (100%) - Installing phpunit/php-timer (1.0.9): Downloading (100%) - Installing phpunit/php-file-iterator (1.4.5): Downloading (100%) - Installing phpunit/php-token-stream (1.4.12): Downloading (100%) - Installing phpunit/php-code-coverage (2.2.4): Downloading (100%) - Installing webmozart/assert (1.3.0): Downloading (100%) - Installing phpdocumentor/reflection-common (1.0.1): Downloading (100%) - Installing phpdocumentor/type-resolver (0.4.0): Downloading (100%) - Installing phpdocumentor/reflection-docblock (4.3.0): Downloading (100%) - Installing phpspec/prophecy (1.8.0): Downloading (100%) - Installing phpunit/phpunit (4.8.36): Downloading (100%) - Installing psr/cache (1.0.1): Downloading (100%) - Installing psr/http-message (1.0.1): Downloading (100%) - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%) - Installing guzzlehttp/promises (v1.3.1): Downloading (100%) - Installing guzzlehttp/guzzle (6.3.3): Downloading (100%) - Installing firebase/php-jwt (v5.0.0): Downloading (100%) - Installing google/auth (v1.4.0): Downloading (100%) - Installing google/apiclient-services (v0.74): Downloading (100%) - Installing psr/log (1.0.2): Downloading (100%) - Installing monolog/monolog (1.23.0): Downloading (100%) - Installing phpseclib/phpseclib (2.0.11): Downloading (100%) - Installing squizlabs/php_codesniffer (2.9.1): Downloading (100%) - Installing symfony/polyfill-mbstring (v1.10.0): Downloading (100%) - Installing symfony/dom-crawler (v2.8.46): Downloading (100%) - Installing symfony/css-selector (v2.8.46): Downloading (100%) - Installing league/flysystem (1.0.46): Downloading (100%) - Installing cache/taggable-cache (0.4.3): Downloading (100%) - Installing cache/adapter-common (0.3.3): Downloading (100%) - Installing cache/filesystem-adapter (0.3.3): Downloading (100%) symfony/yaml suggests installing symfony/console (For validating YAML files using the lint command) sebastian/global-state suggests installing ext-uopz (*) phpunit/phpunit-mock-objects suggests installing ext-soap (*) phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1) phpunit/phpunit suggests installing phpunit/php-invoker (~1.1) monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB) monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server) monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required)) monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server) monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server) monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver) monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib) monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome) monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar) monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server) monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server) phpseclib/phpseclib suggests installing ext-libsodium (SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.) phpseclib/phpseclib suggests installing ext-mcrypt (Install the Mcrypt extension in order to speed up a few other cryptographic operations.) phpseclib/phpseclib suggests installing ext-gmp (Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.) league/flysystem suggests installing ext-fileinfo (Required for MimeType) league/flysystem suggests installing ext-ftp (Allows you to use FTP server storage) league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2) league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3) league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage) league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching) league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem) league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files) league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib) league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage) league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter) league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage) league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications) Writing lock file Generating autoload files [RuntimeException] Could not scan for classes inside "src/Google/Service/" which does not appe ar to be a file nor a folder update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...
追記2
上記の処理でできたvendorにgithubからダウンロードしたgoogle-api-php-clientを入れて以下のコードを実行しました。
php
1<?php 2require_once("/vendor/autoload.php"); 3session_start(); 4 5$OAUTH2_CLIENT_ID = ""; 6$OAUTH2_CLIENT_SECRET = ""; 7 8$client = new Google_Client(); 9$client->setClientId($OAUTH2_CLIENT_ID); 10$client->setClientSecret($OAUTH2_CLIENT_SECRET); 11?>
そうしたら以下のエラーが出ました。
Fatal error: Uncaught Error: Class 'Google_Client' not found in C:\xampp\htdocs\TestPHP\test.php:8 Stack trace: #0 {main} thrown in C:\test.php on line 8



回答2件
あなたの回答
tips
プレビュー