PHPackages                             nassirian/laravel-github-deployer - 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. nassirian/laravel-github-deployer

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

nassirian/laravel-github-deployer
=================================

A simple GitHub webhook-based deployer for Laravel applications.

v0.0.7(1y ago)18MITPHPPHP ^8.0CI passing

Since Apr 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nassirian/laravel-github-deployer)[ Packagist](https://packagist.org/packages/nassirian/laravel-github-deployer)[ RSS](/packages/nassirian-laravel-github-deployer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (8)Used By (0)

Laravel GitHub Deployer
=======================

[](#laravel-github-deployer)

[![Latest Version](https://camo.githubusercontent.com/a11919b4657cf54c87eba5a9cb649f0dd02107bc1801212c1822980d5e6a51b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e617373697269616e2f6c61726176656c2d6769746875622d6465706c6f7965722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nassirian/laravel-github-deployer)[![Build Status](https://github.com/nassirian/laravel-github-deployer/actions/workflows/tests.yml/badge.svg)](https://github.com/nassirian/laravel-github-deployer/actions)[![License](https://camo.githubusercontent.com/7dd5add7f270452bb1d9a4f41c9defd0a46e6ec08a798453c4f595fd84d8899b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e617373697269616e2f6c61726176656c2d6769746875622d6465706c6f7965722e7376673f7374796c653d666c61742d737175617265)](https://github.com/nassirian/laravel-github-deployer/blob/main/LICENSE)

**Simple and flexible Laravel package** to automate deployments using **GitHub Webhooks**.

This package supports both:

- 🔁 Synchronous deployments (runs directly on the server)
- 🧵 Queue-based deployments (offloaded to dedicated queue workers — e.g., Docker container or remote worker)

### ✅ Features

[](#-features)

- Git pull
- Composer install
- Docker container restart
- Laravel migrations, route/config caching
- Dedicated `deploy` queue support
- Secure signature verification from GitHub

---

📦 Installation
--------------

[](#-installation)

```
composer require nassirian/laravel-github-deployer
```

---

⚙️ Configuration (Optional)
---------------------------

[](#️-configuration-optional)

Publish the config file to customize deployment behavior:

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

This creates: `config/github-deployer.php`

```
return [

    // 'sync' will run directly on server, 'queue' will dispatch a job to deploy queue
    'mode' => env('DEPLOY_MODE', 'queue'),

    // Deploy queue name for queue-based mode
    'queue_name' => env('DEPLOY_QUEUE', 'deploy'),

    // Optional job middleware (e.g., throttle or queue isolation)
    'middleware' => [
        \Nassirian\GitHubDeployer\Middleware\EnsureDeployQueue::class,
    ],

    // Commands to run before deploy
    'pre_deploy_commands' => [],

    // Main deploy commands
    'deploy_commands' => [
        'git pull origin main',
        'composer install --no-interaction --prefer-dist --optimize-autoloader',
        'docker-compose pull',
        'docker-compose up -d',
    ],

    // Post-deploy artisan commands
    'post_deploy_commands' => [
        'php artisan migrate --force',
        'php artisan config:cache',
        'php artisan route:cache',
    ],

    // Optional throttle behavior for wrong queue workers
    'deploy_release_throttle' => [
        'base_delay' => 5,
        'max_attempts' => 5,
    ],
];
```

---

📡 GitHub Webhook Setup
----------------------

[](#-github-webhook-setup)

1. **Expose your webhook route**

Laravel will respond to:

```
POST /github/webhook

```

2. **Add Webhook in GitHub**:

    - Go to **Repo Settings → Webhooks → Add Webhook**
    - Payload URL: `https://your-domain.com/github/webhook`
    - Content type: `application/json`
    - Secret: `your-random-string`
    - Events: ✅ Push event only
3. **Set secret in `.env`:**

```
GITHUB_WEBHOOK_SECRET=your-random-string
```

---

⚙️ Sync vs Queue Mode
---------------------

[](#️-sync-vs-queue-mode)

ModeDescription`sync`Runs deployment commands immediately in the HTTP request (for small projects or simple VPS)`queue`Dispatches a background job to the `deploy` queue (best for Docker, Horizon, supervisors)Set this in your `.env`:

```
DEPLOY_MODE=queue
DEPLOY_QUEUE=deploy
```

Then, in `supervisord` or Docker, run:

```
php artisan queue:work --queue=deploy
```

---

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

[](#-how-it-works)

1. GitHub sends a webhook → `/github/webhook`
2. Laravel verifies the HMAC signature
3. Based on config mode:
    - `sync`: Runs the deploy shell commands right away
    - `queue`: Dispatches a background job to the `deploy` queue
4. Commands are run in 3 phases:
    - `pre_deploy_commands`
    - `deploy_commands`
    - `post_deploy_commands`

---

📚 Tips &amp; Extensions
-----------------------

[](#-tips--extensions)

- Need `npm run build`? Add it to `deploy_commands`
- Want zero-downtime? Use `php artisan down` / `up` in `pre/post`
- Using Horizon? Just isolate `deploy` workers separately

---

🔐 Security
----------

[](#-security)

- Verifies GitHub `X-Hub-Signature-256`
- Jobs can self-check queue name (`EnsureDeployQueue`)
- Workers on wrong queues will back off with throttling

---

📋 Requirements
--------------

[](#-requirements)

- PHP 8.1+
- Laravel 9.x → 12.x
- GitHub webhook support
- Docker (optional)
- Supervisor or Horizon (for queue mode)

---

💼 License
---------

[](#-license)

This package is open-sourced under the [MIT license](LICENSE).

---

✨ Deployment Flow Example
-------------------------

[](#-deployment-flow-example)

```
GitHub Push →
Webhook triggered →
Dispatch Job →
Run:
  git pull
  composer install
  docker-compose pull
  docker-compose up -d
  php artisan migrate
  php artisan config:cache
  php artisan route:cache

```

Fully automated. No manual SSH. No downtime.
🔥 Your deployments are now modern and effortless.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance51

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

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.

###  Release Activity

Cadence

Every ~0 days

Total

7

Last Release

374d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9d9fdc22828aa9fa7ce1a87e7e5975ee7430e22aa9fc53e25d103aa5d0e005a?d=identicon)[nassirian](/maintainers/nassirian)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/nassirian-laravel-github-deployer/health.svg)

```
[![Health](https://phpackages.com/badges/nassirian-laravel-github-deployer/health.svg)](https://phpackages.com/packages/nassirian-laravel-github-deployer)
```

###  Alternatives

[timokoerber/laravel-one-time-operations

Run operations once after deployment - just like you do it with migrations!

6481.7M11](/packages/timokoerber-laravel-one-time-operations)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[sammyjo20/lasso

Lasso - Asset wrangling for Laravel made simple.

355347.9k](/packages/sammyjo20-lasso)[stechstudio/laravel-env-security

Securely manage .env files for different deployment environments

77116.4k1](/packages/stechstudio-laravel-env-security)[aaronfrancis/airdrop

A Laravel package to deploy your application faster by skipping asset compilation when possible.

19594.9k](/packages/aaronfrancis-airdrop)[richdynamix/arc

Production ready docker based development environment for your Laravel project.

1163.1k](/packages/richdynamix-arc)

PHPackages © 2026

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