1. Go to this page and download the library: Download getxpos/laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use GetXPOS\Laravel\XposTunnel;
$tunnel = XposTunnel::connect(['port' => 8000]);
echo $tunnel->url;
$tunnel->close();
use GetXPOS\Laravel\Facades\Xpos;
// In your test setup
$tunnel = Xpos::connect(['port' => 8000, 'token' => 'tk_xxx']);
// Configure Stripe to send webhooks to your tunnel
$stripe = new \Stripe\StripeClient('sk_test_xxx');
$stripe->webhookEndpoints->create([
'url' => $tunnel->url . '/api/webhooks/stripe',
'enabled_events' => ['payment_intent.succeeded'],
]);
// Run your tests...
$tunnel->close();
use GetXPOS\Laravel\XposTunnel;
$tunnel = new XposTunnel(['port' => 8000]);
$tunnel->onConnect(function (array $info) {
echo "Connected: {$info['url']}\n";
// $info['expiresAt'] may be null for paid plans
});
$tunnel->onClose(function (?int $exitCode) {
echo "Tunnel closed (exit: {$exitCode})\n";
});
$tunnel->onOutput(function (string $data) {
// Raw SSH output
});
$tunnel->start();
// Block until process exits
$tunnel->wait();