承接 getxpos/laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

getxpos/laravel

Composer 安装命令:

composer require getxpos/laravel

包简介

Laravel SDK for XPOS — instant public URLs with token auth, reserved subdomains, and custom domains

README 文档

README

Latest Version on Packagist Total Downloads License

Instant public URLs for Laravel development. Expose your local app with a single command or programmatically from code — supports token auth, reserved subdomains, custom domains, and TCP tunnels.

xpos.dev

Features

  • One Commandphp artisan xpos gets you a public HTTPS URL instantly
  • Programmatic APIXpos::connect(['port' => 8000]) for webhook testing and automated workflows
  • TCP Tunnels — expose databases, Redis, or any TCP service
  • Token Auth — longer sessions, reserved subdomains, and custom domains with an XPOS token
  • Reserved Subdomains — keep myapp.xpos.to across sessions (Pro plan)
  • Custom Domains — use your own domain like dev.example.com (Business plan)
  • Auto-Start Server — starts php artisan serve automatically if not running
  • Auto TrustProxies — HTTPS URLs work correctly out of the box
  • Laravel 10+ — full support

Installation

composer require getxpos/laravel --dev

Quick Start

CLI:

php artisan xpos

Programmatic:

use GetXPOS\Laravel\Facades\Xpos;

$tunnel = Xpos::connect(['port' => 8000]);
echo $tunnel->url; // https://abc123.xpos.to
$tunnel->close();

Authentication

For longer sessions and more features, add your XPOS token to .env:

XPOS_TOKEN=tk_your_token_here

Get your token at xpos.dev/dashboard/tokens.

CLI Usage

# Anonymous tunnel (random subdomain, 3hr expiry)
php artisan xpos

# Authenticated tunnel (uses XPOS_TOKEN from .env)
php artisan xpos

# Reserved subdomain (Pro plan)
php artisan xpos --subdomain=myapp

# Custom domain (Business plan)
php artisan xpos --domain=dev.example.com

# Override token from command line
php artisan xpos --token=tk_your_token

# Use a specific port
php artisan xpos --port=8080

# Use an existing server (skip starting artisan serve)
php artisan xpos --no-serve --port=3000

# Bind to a specific host
php artisan xpos --host=0.0.0.0

# TCP tunnel (database, Redis, etc.)
php artisan xpos --mode=tcp --port=5432 --token=tk_xxx

Programmatic API

Create tunnels from your PHP code — useful for webhook testing, integration tests, and automated workflows.

Basic Usage

use GetXPOS\Laravel\Facades\Xpos;

$tunnel = Xpos::connect(['port' => 8000]);

echo $tunnel->url;       // https://abc123.xpos.to
echo $tunnel->expiresAt; // 2026-03-28T10:30:45Z

$tunnel->close();

With Options

$tunnel = Xpos::connect([
    'port' => 8000,
    'token' => 'tk_your_token',
    'subdomain' => 'myapp',
]);
// https://myapp.xpos.to

Without Facade

use GetXPOS\Laravel\XposTunnel;

$tunnel = XposTunnel::connect(['port' => 8000]);
echo $tunnel->url;
$tunnel->close();

Webhook Testing

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();

Callbacks

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();

Note: onClose fires during wait() or close() — PHP runs synchronously, so there is no background event loop.

TCP Tunnels

Expose any TCP service (databases, Redis, message queues, etc.).

CLI

# Expose PostgreSQL
php artisan xpos --mode=tcp --port=5432 --token=tk_xxx

# Expose Redis
php artisan xpos --mode=tcp --port=6379 --token=tk_xxx

# Expose MySQL
php artisan xpos --mode=tcp --port=3306 --token=tk_xxx

Programmatic

use GetXPOS\Laravel\Facades\Xpos;

$tunnel = Xpos::connect([
    'mode' => 'tcp',
    'port' => 5432,
    'token' => 'tk_xxx',
]);

echo $tunnel->url; // 203.0.113.5:34567 (ip:port)

$tunnel->close();

Note: TCP tunnels require authentication (a token). The tunnel URL is an ip:port pair instead of an HTTPS URL.

Configuration

Publish the config file:

php artisan vendor:publish --tag=xpos-config

Options in config/xpos.php:

Key Default Description
token env('XPOS_TOKEN') Auth token from xpos.dev dashboard
server go.xpos.dev XPOS tunnel server
ssh_port 443 SSH port
default_port 8000 Default dev server port
trust_proxies true Auto-configure TrustProxies for HTTPS

HTTPS & TrustProxies

The package automatically configures Laravel's TrustProxies middleware so asset(), url(), route(), and other helpers generate correct HTTPS URLs when accessed through an XPOS tunnel.

This works with *.xpos.to subdomains, custom domains, and any future tunnel domains. Disable with XPOS_TRUST_PROXIES=false in .env if needed.

Requirements

  • PHP 8.1+
  • Laravel 10+
  • SSH client in PATH

Troubleshooting

Port already in use?

php artisan xpos --port=8001

SSH connection issues?

  • Ensure SSH client is installed and in PATH
  • Check firewall settings for port 443

HTTPS URLs not working?

  • Ensure trust_proxies is true in config/xpos.php
  • Clear config cache: php artisan config:clear

Reserved subdomain not working?

  • Ensure XPOS_TOKEN is set in .env
  • Verify your plan supports reserved subdomains at xpos.dev

TCP mode requires --port?

  • TCP mode doesn't auto-start artisan serve — you must specify the port of the service you're exposing: --mode=tcp --port=5432

TCP tunnel shows "authentication required"?

  • TCP tunnels require a token. Set XPOS_TOKEN in .env or pass --token=tk_xxx

.gitignore

Add .xpos.pid to your project's .gitignore:

.xpos.pid

Links

License

MIT License. See LICENSE for details.

getxpos/laravel 适用场景与选型建议

getxpos/laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「ssh」 「development」 「laravel」 「localhost」 「tunnel」 「share」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 getxpos/laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 getxpos/laravel 我们能提供哪些服务?
定制开发 / 二次开发

基于 getxpos/laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 41
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-28