- RSS フィードを購読する
- トピックを新着としてマーク
- トピックを既読としてマーク
- このスレッドを現在のユーザーにフロートします
- ブックマーク
- 購読
- 印刷用ページ
composer.jsonで何かやらかしてるか
それとも何か手順が抜けてるかだと思いますが
いくらマニュアルを読み込んでもわかりません…
もしなにかありましたらご指摘お願いします
■サーバ環境
PHP Version 7.4.10
FreeBSD 11.2-RELEASE-p14
■PHP-SDK
composerにてインストール済み
(Using version[Redacted]6 for square/square)
■composer.json→install済み
{
"name": "square/square",
"description": "Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.",
"version": "[Redacted]6",
"type": "library",
"keywords": [
"Square",
"API",
"SDK"
],
"homepage": "https://squareup.com/developers",
"license": "MIT",
"authors": [
{
"name": "Square Developer Platform",
"email": "developers@squareup.com",
"homepage": "https://squareup.com/developers"
}
],
"require": {
"php": ">=7.1",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"apimatic/unirest-php": "^2.0",
"apimatic/jsonmapper": "^2.0.1"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"phan/phan": "^2.5",
"phpunit/phpunit": "^7.5 || ^8.5"
},
"autoload": {
"psr-4": {
"Square\\": "src/"
}
},
"scripts": {
"test": "phpunit",
"test-coverage": "phpunit --coverage-html=coverage",
"lint": "phpcs --standard=phpcs-ruleset.xml src/",
"lint-fix": "phpcbf --standard=phpcs-ruleset.xml src/",
"analyze": "phan --allow-polyfill-parser"
}
}
■テストPHP
↓パス確認済み
require_once('/home/{user}/vendor/autoload.php');
use Square\SquareClient;
use Square\LocationsApi;
use Square\Exceptions\ApiException;
use Square\Http\ApiResponse;
use Square\Models\ListLocationsResponse;
use Square\Environment;
$client = new SquareClient([
'accessToken' => '{アクセストークン]',
'environment' => Environment::SANDBOX,
]);
try {
$locationsApi = $client->getLocationsApi();
$apiResponse = $locationsApi->listLocations();
if ($apiResponse->isSuccess()) {
$listLocationsResponse = $apiResponse->getResult();
$locationsList = $listLocationsResponse->getLocations();
foreach ($locationsList as $location) {
print_r($location);
}
} else {
print_r($apiResponse->getErrors());
}
} catch (ApiException $e) {
print_r("Recieved error while calling Square: " . $e->getMessage());
}
■PHPエラー
Fatal error: Uncaught Error: Class 'Square\SquareClient' not found
- 新着としてマーク
- ブックマーク
- 購読
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
- 新着としてマーク
- ブックマーク
- 購読
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告