Я пытаюсь использовать PHP клиент для newsapi.org, но постоянно получаю сообщение об ошибке = 255.
Инструкции из файла readme.md:
Установка: Доступно для установки на Packagist с использованием composer.
Я выполнил эту часть выполнения и получил это подтверждение.
C:\Users\V****l>composer require jcobhams/newsapi
Using version ^1.0 for jcobhams/newsapi
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 9 installs, 0 updates, 0 removals
- Installing ralouphie/getallheaders (3.0.3): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing guzzlehttp/psr7 (1.6.1): Downloading (100%)
- Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
- Installing symfony/polyfill-php72 (v1.15.0): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.15.0): Downloading (100%)
- Installing symfony/polyfill-intl-idn (v1.15.0): Downloading (100%)
- Installing guzzlehttp/guzzle (6.5.3): Downloading (100%)
- Installing jcobhams/newsapi (v1.0): Downloading (100%)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
symfony/polyfill-intl-idn suggests installing ext-intl (For best performance)
guzzlehttp/guzzle suggests installing psr/log (Required for using the Log middleware)
Writing lock file
Generating autoload files
3 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Использование после установки и require
ing vendor/autoload.php
файла в вашем проекте Получите ваш ключ API, затем use jcobhams\NewsApi\NewsApi' . . . $newsapi = new NewsApi('81ef74d2460440249ac5645ee3be450b');
Мой тестовый код
<?php
require 'vendor/autoload.php';
use jcobhams\NewsApi\NewsApi;
$newsapi = new NewsApi('81ef74d2460440249ac5645ee3be450b');
$newsapi -> getCountries();
?>
Я следовал инструкциям https://github.com/jcobhams/newsapi-php, но я все еще получаю вывод
[Running] php "c:\xampp\htdocs\UniFi\test1.txt"
[Done] exited with code=255 in 0.204 seconds
Я впервые работаю с Composer и Packagist, правильно ли я его использую