承接 laragear/expose 相关项目开发

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

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

laragear/expose

Composer 安装命令:

composer require laragear/expose

包简介

Expose your local PHP project to the internet via popular tunnel services.

README 文档

README

Latest Version on Packagist Latest stable test run Codecov coverage Maintainability Sonarcloud Status

Expose your application to the Internet in one command

composer expose

Become a sponsor

Your support allows me to keep this package free, up to date, and maintainable.

Requirements

  • Linux or macOS (Windows may work)
  • PHP 8.3 or later
  • Composer 2.6 or higher
  • A PHP project with a composer.json at the root (recommended)

Installation

You can install the package via Composer.

composer require global laragear/expose

How does this work?

This composer plugin manages popular tunneling services to expose your application on the Internet. This is great when you want to show your application development to somebody far away, through a simple link, especially when dealing with live-client videocalls or meetings.

Supported Tunnel Services

Service Key Distributed as Auth required
ngrok ngrok Binary (cURL) Optional (free tier)
Cloudflare Tunnel cloudflare Binary (cURL) Optional (quick tunnels)
InstaTunnel instatunnel NPM package Optional
Localtunnel localtunnel NPM package No
Pinggy pinggy SSH (system binary) Optional
Zrok zrok Binary (cURL) Yes (free account)

Tip

You can add your own tunnel services.

Usage

To expose your application to the Internet, simple use composer expose:

composer expose

On the first run, the command will:

  1. Detect your PHP framework (Laravel, Symfony, WordPress, CakePHP, Yii, Lumen, or plain PHP).
  2. Ask which tunnel service you prefer, then save the choice to composer.json.
  3. Check that the tunnel binary is installed; download it or guide you through manual installation if not.
  4. Run a local development server on http://localhost:8080 (or the preferreded by your app).
  5. Start the tunnel and print the public URL.

The are some options you can use when exposing your application:

Option Short Description
--host Local host to bind to (default: localhost)
--port -p Local port to bind to (default: 8080)
--tunnel -t Override the tunnel service for this run only

For example, you can use ngrok using an alternative host and port.

composer expose --port=9000
composer expose --tunnel=cloudflare

Updating tunnels

To update the tunnel library, or only one given tunnel, use the expose:update command.

composer expose:update
composer expose:update --force          # Force re-download
composer expose:update --tunnel=ngrok   # Target a specific service

Configuring tunnels

The expose:configure command will walk you through service-specific prompts (auth tokens, subdomains, regions, etc.) to properly configure the tunnel you're using.

composer expose:configure
composer expose:configure --reset       # Clear saved tunnel preference

Tip

Sensitive values like auth tokens are never set in the composer.json.

Checking tunnel status

To display whether the tunnel is running, the current public URL, and the connection count (where available), use the expose:status command.

composer expose:status

Uninstall tunnel binaries

The expose:uninstall command will uninstall all tunnel binaries. It does not uninstall the plugin.

composer expose:uninstall
composer expose:uninstall --purge       # Also remove all Expose config from composer.json

Adding additional tunnels

You may be not happy with the current selection of tunnels. In that case, you can add your own tunnel in your extra.expose key in your composer.json.

The tunnel should state the default tunnel, and the tunnels should describe your tunnels labels and class.

{
    "extra": {
        "expose": {
            "tunnel": "my-vpn",
            "tunnels": {
                "my-vpn": {
                    "label": "My Corporate VPN Tunnel",
                    "class": "App\\DevTools\\CorpVpnTunnel"
                }
            }
        }
    }
}

The CorpVpnTunnel class must implement Laragear\Expose\Contracts\Tunnel (or extend AbstractTunnel which may be easier):

namespace App\DevTools;

use Laragear\Expose\Tunnels\AbstractTunnel;
use Symfony\Component\Process\Process;

class CorpVpnTunnel extends AbstractTunnel
{
    public function name(): string 
    { 
        return 'Corporate VPN';
    }

    public function binary(): string
    {
        return 'vpntunnel';
    }

    public function start(string $host, int $port): Process
    {
        $process = $this->buildProcess([
            $this->binaryCommand(), '--local', "{$host}:{$port}",
        ]);
        
        $process->start();
        
        return $process;
    }
}

Adding a tunnel via package

If you're a package author, you can also make your package a tunnel-provider by offering your own adapter through the extra.expose-tunnel key.

{
    "name": "acme/my-tunnel",
    "extra": {
        "expose-tunnel": {
            "key":   "acme",
            "label": "Acme Tunnel (acme.example.com)",
            "class": "Acme\\Tunnel\\AcmeTunnel"
        }
    }
}

Security

If you discover any security-related issues, issue a Security Advisory.

License

This specific package version is licensed under the terms of the MIT License, at the time of publishing.

Laravel is a Trademark of Taylor Otwell. Copyright © 2011-2026 Laravel LLC.

laragear/expose 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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