PHPackages                             indemnity83/anvil - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. indemnity83/anvil

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

indemnity83/anvil
=================

Anvil: package and ship Laravel apps as self-contained zip artifacts for the Anvil runtime (or any PHP host).

05PHPCI passing

Since Apr 27Pushed 5mo ago1 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

**Anvil**
=========

[](#anvil)

> **Package and run simple Laravel apps—cleanly, predictably, and without server-side build tools.**

Anvil is a small system that helps you **package a Laravel application into a deployable ZIP artifact**, and then **run that artifact** in a lightweight Docker runtime.

It’s designed for homelabs, Unraid users, hobby projects, and anyone who wants a **Forge-like deploy workflow**—without needing Composer, Node, or build tooling on the server.

---

**Why Anvil?**
--------------

[](#why-anvil)

Laravel has an excellent local development experience, but deploying simple apps often requires:

- PHP + Composer installed on the server
- Node/Vite for asset compilation
- Managing versions of PHP extensions
- Build steps during deploy
- App-specific Dockerfile maintenance

**Anvil eliminates all of that.**

With Anvil:

### 🎁 Build an app artifact (locally or in CI)

[](#-build-an-app-artifact-locally-or-in-ci)

```
php artisan anvil:build
```

This produces a ZIP containing:

- Your Laravel app source
- `vendor/` dependencies
- Built frontend assets
- Cached config/routes (optional)

Ready to deploy anywhere.

### 🚀 Run the artifact using the Anvil runtime image

[](#-run-the-artifact-using-the-anvil-runtime-image)

Anvil includes a minimal Docker image that:

- mounts your packaged app
- runs migrations
- runs `artisan serve`
- can run queue workers (including Horizon)
- can run scheduled tasks

You get a simple, predictable, standalone environment.

If you want a bit more power, Anvil also works seamlessly with external services like **MySQL/PostgreSQL** or **Redis**.
Just point your `.env` values (e.g., `DB_HOST`, `DB_DATABASE`, `REDIS_HOST`) at the services you’re running.
No special flags, no proprietary configuration layers, and no container magic glue required—Anvil always respects your application's own `.env` file.

---

**How It Works**
================

[](#how-it-works)

Anvil is actually two pieces:

**1. The Laravel Package (this repo)**
--------------------------------------

[](#1-the-laravel-package-this-repo)

When installed in a Laravel app:

```
composer require --dev indemnity83/anvil
```

…it provides the command:

```
php artisan anvil:build
```

That command:

- runs `composer install` (prod deps)
- runs your JS build (`npm ci && npm run build`)
- warms caches
- stages the app
- creates a ZIP at:

```
storage/app/anvil/anvil-package.zip

```

This artifact contains everything needed to run your app on any PHP host—including Anvil.

---

**2. The Anvil Runtime (docker/ directory)**
--------------------------------------------

[](#2-the-anvil-runtime-docker-directory)

Inside `docker/` you’ll find:

- `Dockerfile` – small PHP-Alpine runtime
- `bin/entrypoint.sh` – handles UID/GID, roles
- `bin/anvil.sh` – artisan shim and server/worker logic

The runtime supports three modes:

### **Server**

[](#server)

```
docker run anvil:php-8.3 server
```

- runs migrations (optional)
- runs scheduler
- runs the built-in Laravel server

### **Worker**

[](#worker)

```
docker run anvil:php-8.3 worker
```

- runs `queue:work` or `horizon` if installed
- integrates with `queue:restart` / `horizon:terminate` for zero-downtime updates

### **Passthrough (artisan)**

[](#passthrough-artisan)

```
docker run anvil:php-8.3 migrate --force
```

Any other command is forwarded to `php artisan ...`. This passthrough mode isn’t something you’ll typically need during normal deployments, but it’s available for special cases—for example, when your host system doesn’t have PHP installed (very common on Unraid and other homelab setups) or when you need to run an occasional maintenance or diagnostic artisan command directly against your app.

---

**Deploy Workflow**
===================

[](#deploy-workflow)

A typical homelab/Unraid deployment looks like:

### **Step 1 – Build the artifact locally**

[](#step-1--build-the-artifact-locally)

```
php artisan anvil:build
```

You can run this command directly on your development machine, or you can automate it using CI/CD tools such as GitHub Actions, GitLab CI, or any other workflow runner. Anvil is designed so that artifact creation can happen anywhere that can run PHP, Composer, and Node.

### **Step 2 – Copy the ZIP to your server**

[](#step-2--copy-the-zip-to-your-server)

(Use whatever: SMB share, SFTP, Unraid file copy, etc.)

### **Step 3 – Unzip into a local directory**

[](#step-3--unzip-into-a-local-directory)

Example:

```
/mnt/user/appdata/myapp

```

### **Step 4 - Start the Docker server container and point it to your local directory**\*

[](#step-4---start-the-docker-server-container-and-point-it-to-your-local-directory)

```
docker run -d \
  --name myapp-server \
  -p 8000:8000 \
  -v /mnt/user/appdata/myapp:/var/www/html \
  -e PUID=99 \
  -e PGID=100 \
  indemnity83/anvil:php-8.3 server
```

That’s it.
No Node. No Composer. No build tooling on the server—ever.

---

**Directory Structure**
=======================

[](#directory-structure)

```
anvil/
  composer.json              # Laravel package definition
  src/                       # Anvil build command + helpers
  config/                    # publishable config
  docker/
    Dockerfile               # Anvil runtime environment
    bin/
      entrypoint.sh
      anvil.sh
  .gitattributes             # excludes docker/ from Composer dist
  .gitignore
  README.md

```

---

**Configuration**
=================

[](#configuration)

After installing in your app:

```
php artisan vendor:publish --tag=anvil-config
```

You’ll get:

```
config/anvil.php

```

Where you can customize:

- build output location
- excluded directories
- NPM binary and script name
- whether to warm caches
- composer flags

---

**Roadmap**
===========

[](#roadmap)

### ✔️ Initial package build

[](#️-initial-package-build)

### ✔️ Docker runtime

[](#️-docker-runtime)

### ✔️ Worker/server role split

[](#️-workerserver-role-split)

### ⬜ `anvil:deploy` (end-to-end build + release + restart)

[](#-anvildeploy-end-to-end-build--release--restart)

### ⬜ GitHub Actions template for automatic artifact builds

[](#-github-actions-template-for-automatic-artifact-builds)

### ⬜ Optional “build image” with Composer + Node baked in

[](#-optional-build-image-with-composer--node-baked-in)

### ⬜ First public release

[](#-first-public-release)

### ⬜ Anvil homepage / docs

[](#-anvil-homepage--docs)

---

**License**
===========

[](#license)

MIT © 2025 Kyle Klaus

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance48

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4130190042e11edc684bcaac2190409d96ef14b139c767bc25b279170e8376a9?d=identicon)[Indemnity83](/maintainers/Indemnity83)

---

Top Contributors

[![Indemnity83](https://avatars.githubusercontent.com/u/35218?v=4)](https://github.com/Indemnity83 "Indemnity83 (10 commits)")

### Embed Badge

![Health badge](/badges/indemnity83-anvil/health.svg)

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

###  Alternatives

[deployer/deployer

Deployment Tool

11.1k25.4M207](/packages/deployer-deployer)[appwrite/server-ce

End to end backend server for frontend and mobile apps.

55.3k84.2k](/packages/appwrite-server-ce)[pragmarx/health

Laravel Server &amp; App Health Monitor and Notifier

2.0k1.0M2](/packages/pragmarx-health)[felixfbecker/language-server-protocol

PHP classes for the Language Server Protocol

22476.7M6](/packages/felixfbecker-language-server-protocol)[heroku/heroku-buildpack-php

Toolkit for starting a PHP application locally, with or without foreman, using the same config for PHP and Apache2/Nginx as on Heroku

8161.3M10](/packages/heroku-heroku-buildpack-php)[tiamo/phpas2

PHPAS2 is a php-based implementation of the EDIINT AS2 standard

4674.7k](/packages/tiamo-phpas2)

PHPackages © 2026

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