PHPackages                             kieranbrown/laraworker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kieranbrown/laraworker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kieranbrown/laraworker
======================

Run Laravel on Cloudflare Workers via php-cgi-wasm

v1.5.4(2mo ago)034↓50%[2 PRs](https://github.com/kieranbrown/laraworker/pulls)MITJavaScriptPHP ^8.5CI passing

Since Feb 23Pushed 1mo agoCompare

[ Source](https://github.com/kieranbrown/laraworker)[ Packagist](https://packagist.org/packages/kieranbrown/laraworker)[ RSS](/packages/kieranbrown-laraworker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (35)Used By (0)

Laraworker
==========

[](#laraworker)

[![PHP 8.5+](https://camo.githubusercontent.com/7c0d3f0931b4e620c6c642a58a60d9a346a7de7d6ac275e62a9552c41821f7b0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e352532422d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://php.net)[![Laravel 12](https://camo.githubusercontent.com/cefd0d247fb4898c829a8e41b76d9663721d33c7b486e081b00e91141ca83051/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322d4646324432303f6c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://laravel.com)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)

Deploy Laravel applications to Cloudflare Workers via PHP WASM.

Laraworker packages your Laravel app into a compressed tar archive, then runs it on Cloudflare Workers using [php-cgi-wasm](https://github.com/nicmart/php-cgi-wasm). On each request, the Worker unpacks the app into an in-memory filesystem and processes it through the PHP WASM runtime — no traditional server required.

Requirements
------------

[](#requirements)

- PHP 8.5+
- Laravel 12
- Node.js or [Bun](https://bun.sh)
- A [Cloudflare](https://cloudflare.com) account

Installation
------------

[](#installation)

```
composer require kieranbrown/laraworker
```

Then run the install command to configure your project:

```
php artisan laraworker:install
```

This will:

- Publish the `config/laraworker.php` configuration file
- Add build scripts and dependencies to `package.json`
- Update `.gitignore` to exclude the `.laraworker/` build directory
- Install npm dependencies (`php-cgi-wasm`, `wrangler`, etc.)
- Run an initial build into `.laraworker/`

Configuration
-------------

[](#configuration)

After installation, configure your setup in `config/laraworker.php`:

```
return [
    // PHP extensions to include in the WASM bundle
    'extensions' => [
        'mbstring' => true,   // ~742 KiB gzipped
        'openssl' => true,    // ~936 KiB gzipped
    ],

    // Directories included in the app bundle (relative to project root)
    'include_dirs' => [
        'app',
        'bootstrap',
        'config',
        'database',
        'routes',
        'resources/views',
        'vendor',
    ],

    // Individual files to include
    'include_files' => [
        'public/index.php',
        'artisan',
        'composer.json',
    ],

    // Regex patterns for files to exclude
    'exclude_patterns' => [
        '/\.git\//',
        '/\/node_modules\//',
        '/\/tests\//',
        // ...
    ],
];
```

### Wrangler Configuration

[](#wrangler-configuration)

Deployment settings like `worker_name`, `account_id`, and `compatibility_date` are configured in `config/laraworker.php`. The `wrangler.jsonc` is auto-generated into `.laraworker/` at build time from these config values.

Usage
-----

[](#usage)

Laraworker provides five Artisan commands:

### `laraworker:install`

[](#laraworkerinstall)

Configure the project for Cloudflare Workers and run an initial build.

```
php artisan laraworker:install
php artisan laraworker:install --force  # Overwrite existing files
```

### `laraworker:build`

[](#laraworkerbuild)

Build the Laravel application for production deployment. Caches config, routes, and views, then packages everything into `app.tar.gz`.

```
php artisan laraworker:build
```

### `laraworker:dev`

[](#laraworkerdev)

Build and start a local development server using `wrangler dev`.

```
php artisan laraworker:dev
```

### `laraworker:deploy`

[](#laraworkerdeploy)

Build and deploy to Cloudflare Workers.

```
php artisan laraworker:deploy
php artisan laraworker:deploy --dry-run  # Build without deploying
```

### `laraworker:status`

[](#laraworkerstatus)

Check installation status, bundle sizes, and tier compatibility.

```
php artisan laraworker:status
```

How It Works
------------

[](#how-it-works)

1. **Build** — Your Laravel app is optimized (cached config/routes/views, classmap autoload) and packaged into a compressed `app.tar.gz`
2. **Deploy** — The archive and PHP WASM binary are deployed to Cloudflare Workers as static assets
3. **Request** — On cold start, the Worker fetches `app.tar.gz`, unpacks it into an in-memory filesystem (MEMFS), and boots the PHP runtime
4. **Process** — Each HTTP request is routed through `php-cgi-wasm`, which executes your Laravel application and returns the response

The entire bundle (WASM binary + app archive + Worker code) fits within Cloudflare Workers' **free tier limit of 3 MB**.

Custom Domain Setup
-------------------

[](#custom-domain-setup)

To serve your app from a custom domain, configure your Cloudflare account with the domain and set up routes. The `wrangler.jsonc` is auto-generated at build time from `config/laraworker.php` — for advanced wrangler settings, you can customize the `stubs/wrangler.jsonc.stub` template.

Make sure your domain is added to your Cloudflare account and DNS is configured.

Extensions
----------

[](#extensions)

Two PHP extensions can be toggled in `config/laraworker.php`:

ExtensionDefaultSize Impact`mbstring`Enabled~742 KiB gzipped`openssl`Enabled~936 KiB gzippedDisabling unused extensions reduces your bundle size, which can help stay within Cloudflare's tier limits.

License
-------

[](#license)

Laraworker is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance87

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 94% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

19

Last Release

73d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8dabe1b3116e2cace37373859890cfc514930d235d750518d5f5642ba6559ec3?d=identicon)[kieranbrown](/maintainers/kieranbrown)

---

Top Contributors

[![kieranbrown](https://avatars.githubusercontent.com/u/25469238?v=4)](https://github.com/kieranbrown "kieranbrown (299 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (19 commits)")

---

Tags

laravelcloudflareworkerswasmphp-wasm

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kieranbrown-laraworker/health.svg)

```
[![Health](https://phpackages.com/badges/kieranbrown-laraworker/health.svg)](https://phpackages.com/packages/kieranbrown-laraworker)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[monicahq/laravel-cloudflare

Add Cloudflare ip addresses to trusted proxies for Laravel.

3372.7M4](/packages/monicahq-laravel-cloudflare)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)[glhd/conveyor-belt

14797.0k](/packages/glhd-conveyor-belt)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
