Download the PHP package laratusk/cloudflare-tunnel without Composer
On this page you can find all versions of the php package laratusk/cloudflare-tunnel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laratusk/cloudflare-tunnel
More information about laratusk/cloudflare-tunnel
Files in laratusk/cloudflare-tunnel
Package cloudflare-tunnel
Short Description Start and manage Cloudflare Tunnels directly from Artisan. Supports both quick (random URL) and named (static hostname) tunnels with callback hooks.
License MIT
Homepage https://github.com/laratusk/cloudflare-tunnel
Informations about the package cloudflare-tunnel
Cloudflare Tunnel for Laravel
Start and manage Cloudflare Tunnels directly from Artisan. Expose your local Laravel application to the internet with a single command — using either a quick tunnel (random URL, zero config) or a named tunnel (static hostname, permanent URL).
Features
- Quick tunnels — Random
*.trycloudflare.comURL, no account required - Named tunnels — Static hostname under your own domain (e.g.
tunnel.example.com) - Events —
TunnelConnectedandTunnelDisconnectedevents for webhook registration, notifications, etc. - Graceful shutdown — Clean process termination on
Ctrl+C
Requirements
- PHP 8.2+
- Laravel 10, 11, 12, or 13
- The
pcntlPHP extension - The
cloudflaredCLI binary
Installation
1. Install cloudflared
macOS (Homebrew):
Linux (Debian/Ubuntu):
Other platforms: See the official download page.
Verify the installation:
2. Install the package
3. Publish the config (optional)
Quick Start
Quick Tunnel (zero config)
Run the command with no additional setup — you get a random public URL instantly:
Named Tunnel (static hostname)
A named tunnel gives you a permanent, predictable URL under your own domain. Follow these steps once to set it up:
Step 1: Authenticate with Cloudflare
This opens your browser. Select the domain you want to use and authorize cloudflared.
Step 2: Create a tunnel
Note the tunnel ID in the output — you'll see it in cloudflared tunnel list too.
Step 3: Route DNS to the tunnel
This creates a CNAME record pointing tunnel.example.com to your tunnel.
Step 4: Create the cloudflared config file
Create ~/.cloudflared/config.yml:
Replace
<TUNNEL-ID>with your actual tunnel ID. ThehttpHostHeadershould match your local development domain. The credentials file path is printed when you create the tunnel.
Step 5: Configure the package
Add to your .env:
Step 6: Run it
Configuration
| Environment Variable | Default | Description |
|---|---|---|
CLOUDFLARE_TUNNEL_MODE |
quick |
quick or named |
CLOUDFLARE_TUNNEL_NAME |
— | Named tunnel name (required for named mode) |
CLOUDFLARE_TUNNEL_HOSTNAME |
— | Static hostname (required for named mode) |
CLOUDFLARE_TUNNEL_LOCAL_URL |
http://127.0.0.1 |
Local URL to forward traffic to |
CLOUDFLARE_TUNNEL_HOST_HEADER |
— | Override the Host header for local requests |
CLOUDFLARE_TUNNEL_TIMEOUT |
30 |
Seconds to wait for tunnel connection |
Events
The package dispatches two events you can hook into with standard Laravel listeners:
| Event | Payload | When |
|---|---|---|
TunnelConnected |
string $url, TunnelMode $mode |
After the tunnel is established |
TunnelDisconnected |
string $url |
Before the process exits (Ctrl+C) |
Example: Register a Telegram webhook
Create a listener:
Laravel auto-discovers listeners, so no manual registration is needed.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
All versions of cloudflare-tunnel with dependencies
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
ext-pcntl Version *