Closed stevanhoo closed 4 years ago
Halo, saya coba bantu jawab ya.
Untuk mengecek apabila library sudah terinstall dan berjalan dengan baik, pastikan di file composer.json
sudah ada require xendit/xendit-php. Dicek juga apakah sudah ada file autoload nya atau belum. Kemudian, buat file baru di directory C:\xampp\htdocs\xendit\tes.php
(bila dilihat dari directory anda), filenya bisa diisi dengan,
<?php
use Xendit\Xendit;
require 'vendor/autoload.php';
Xendit::setApiKey('api-key-anda'); // ganti API key dengan milik anda
$getBalance = \Xendit\Balance::getBalance('CASH');
var_dump($getBalance);
Cuplikan kode di atas adalah untuk mengecek saldo akun Xendit anda. Jalankan file tes.php
tersebut. Bila library sudah terinstall dengan baik, maka saldo akan muncul ketika anda menjalankan file tersebut.
halo, saya coba integrasikan xendit ke CI3, muncul error begini @ellennugroho
{ "require": { "symfony/dotenv": "^4.4", "xendit/xendit-php": "^1.4" } }
ini isi composer.json folder root
{ "name": "xendit/xendit-php-clients", "description": "PHP clients for xendit api version 2", "keywords": ["xendit"], "homepage": "https://github.com/xendit/xendit-php-clients", "type": "library", "minimum-stability": "stable", "require": { "php": ">=5.4.0" }, "autoload": { "psr-4": { "XenditClient\\": "src/" } } }
ini isi composer.json xendit/xendit-php
Hi @bektigalan , to use Xendit
class, you have to install v2 of the library. I would recommend latest ^2.4
Stale
halo @tahaluindo, bisa jelasin proses installnya?
sama eror nya
C:\laravel\only-artperience>composer require xendit/xendit-laravel You are running Composer with SSL/TLS protection disabled.
In PackageDiscoveryTrait.php line 376:
Could not find a matching version of package xendit/xendit-laravel. Check the package spelling, your version constr aint and that the package is available in a stability which matches your minimum-stability (dev).
kennapa ya
Type: Error
Message: Class "Xendit\Xendit" not found
Filename: C:\xampp\htdocs\sarangwayang\application\controllers\Dashboard.php
Line Number: 229
Backtrace:
File: C:\xampp\htdocs\sarangwayang\index.php Line: 315 Function: require_once
saya sudah install dengan composer dan muncul folder vendor
lalu next stepnya, saya buka di localhost http://localhost/xendit/vendor/xendit/xendit-php/tests/TestCase.php
keluar eror Fatal error: Uncaught Error: Class 'PHPUnit\Framework\TestCase' not found in C:\xampp\htdocs\xendit\vendor\xendit\xendit-php\tests\TestCase.php:25 Stack trace: #0 {main} thrown in C:\xampp\htdocs\xendit\vendor\xendit\xendit-php\tests\TestCase.php on line 25
boleh tolong ??