A simple GitHub webhook-based deployer for Laravel applications.
nassirian/laravel-github-deployer is a Laravel package for a simple github webhook-based deployer for laravel applications..
It currently has 1 GitHub stars and 12 downloads on Packagist (latest version v0.0.7).
Install it with composer require nassirian/laravel-github-deployer.
Discover more Laravel packages by nassirian
or browse all Laravel packages to compare alternatives.
Last updated
Simple and flexible Laravel package to automate deployments using GitHub Webhooks.
This package supports both:
deploy queue supportcomposer require nassirian/laravel-github-deployer
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,
],
];
Laravel will respond to:
POST /github/webhook
Add Webhook in GitHub:
https://your-domain.com/github/webhookapplication/jsonyour-random-stringSet secret in .env:
GITHUB_WEBHOOK_SECRET=your-random-string
| Mode | Description |
|------|-------------|
| 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
/github/webhooksync: Runs the deploy shell commands right awayqueue: Dispatches a background job to the deploy queuepre_deploy_commandsdeploy_commandspost_deploy_commandsnpm run build? Add it to deploy_commandsphp artisan down / up in pre/postdeploy workers separatelyX-Hub-Signature-256EnsureDeployQueue)This package is open-sourced under the MIT license.
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.