Expose your application to the Internet in one command
composer exposeYour support allows me to keep this package free, up to date, and maintainable.
- Linux or macOS (Windows may work)
- PHP 8.3 or later
- Composer 2.6 or higher
- A PHP project with a
composer.jsonat the root
You can install the package via Composer.
composer require global laragear/exposeThis 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.
| Service | Key | Distributed as | Auth required |
|---|---|---|---|
| ngrok | ngrok |
Binary (cURL) | Optional (free tier) |
| Cloudflare Tunnel | cloudflare |
Binary (cURL) | Optional (quick tunnels) |
| InsTunnel | 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.
To expose your application to the Internet, simple use composer expose:
composer exposeOn the first run, the command will:
- Detect your PHP framework (Laravel, Symfony, WordPress, CakePHP, Yii, Lumen, or plain PHP).
- Ask which tunnel service you prefer, then save the choice to
composer.json. - Check that the tunnel binary is installed; download it or guide you through manual installation if not.
- Run a local development server on
http://localhost:8080(or the preferreded by your app). - 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=cloudflareTo 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 serviceThe 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 preferenceTip
Sensitive values like auth tokens are never set in the composer.json.
To display whether the tunnel is running, the current public URL, and the connection count (where available), use the expose:status command.
composer expose:statusThe 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.jsonYou 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;
}
}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"
}
}
}You can publish the configuration through vendor:publish:
php artisan vendor:publish --provider="Laragear\Expose\ExposeServiceProvider" --tag="config"You should receive a file with an array like this:
return [
// ...
]If you discover any security-related issues, issue a Security Advisory.
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.
