PHPackages                             mpge/govel - 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. mpge/govel

ActiveLibrary

mpge/govel
==========

Execute high-performance Go tasks from Laravel as if they were native jobs.

v0.2.0(1mo ago)229↓100%1MITPHPPHP ^8.3CI passing

Since Apr 5Pushed 1mo agoCompare

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

READMEChangelogDependencies (5)Versions (3)Used By (1)

 [![Govel — Go-powered task execution for Laravel](art/logo.png)](art/logo.png)

 [![Latest Version on Packagist](https://camo.githubusercontent.com/817d1d12dbe3de8d96dd94f9090b0101e55ec42edf66a87a0cf10de07f19c692/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d7067652f676f76656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mpge/govel) [![Total Downloads](https://camo.githubusercontent.com/a898fd438cb49c3ef52b1b8ee7e4a2c2623c2b1994045d15d6c098a33cc59da6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7067652f676f76656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mpge/govel) [![PHP Version](https://camo.githubusercontent.com/273fced0381c5fb74300c50a88b54dc64e03490f9cb79a2c46d05a0dda71675d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d7067652f676f76656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mpge/govel) [![Tests](https://camo.githubusercontent.com/6adba98e12c3ae2a88406803b9559509b82bf1bac4b588b3bd36288989051c7e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d7067652f676f76656c2f74657374732e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://github.com/mpge/govel/actions) [![License](https://camo.githubusercontent.com/8521b3df3663c7f118b7eca92340282bebffd286c6093232d17637d3ecd8efdc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d7067652f676f76656c2e7376673f7374796c653d666c61742d737175617265)](https://github.com/mpge/govel/blob/main/LICENSE)

 Execute high-performance Go tasks from Laravel as if they were native jobs.
 No extensions. No embedding. Just blazing-fast Go binaries behind a clean Laravel API.

---

Why Govel?
----------

[](#why-govel)

Some workloads — image processing, data crunching, cryptography, file parsing — are simply faster in Go. Govel lets you offload these to compiled Go binaries while keeping your application logic in Laravel.

```
use Mpge\Govel\Facades\Govel;
use App\Tasks\ProcessImage;

// Synchronous
$result = Govel::run(ProcessImage::class, [
    'path' => '/tmp/image.jpg',
    'width' => 800,
]);

// Asynchronous (fire-and-forget)
Govel::dispatch(ProcessImage::class, ['path' => '/tmp/image.jpg']);

// Queue (Laravel queue integration)
Govel::queue(ProcessImage::class, ['path' => '/tmp/image.jpg'])
    ->onQueue('processing')
    ->delay(30);
```

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

[](#requirements)

- PHP 8.3+
- Laravel 11+
- Go 1.21+ (for compiling workers)

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

[](#installation)

```
composer require mpge/govel
```

Publish the config file:

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

Quick Start
-----------

[](#quick-start)

Govel provides Artisan commands to scaffold everything you need:

```
# 1. Create a task class
php artisan govel:make-task ProcessImage
# → app/Tasks/ProcessImage.php

# 2. Scaffold the Go worker
php artisan govel:make-worker process-image
# → bin/workers/process-image/main.go

# 3. Compile the worker
php artisan govel:build process-image
# → bin/process-image

# 4. Run it
Govel::run(ProcessImage::class, ['path' => '/tmp/photo.jpg']);
```

Artisan Commands
----------------

[](#artisan-commands)

CommandDescription`govel:make-task {name}`Scaffold a new Task class at `app/Tasks/{Name}.php``govel:make-worker {name}`Scaffold a Go worker with `main.go` and `go.mod` at `bin/workers/{name}/``govel:build {name?}`Compile Go workers into binaries. Omit name to build all.`govel:list`List all available tasks with binary status (found/missing)### govel:make-task

[](#govelmake-task)

```
php artisan govel:make-task ResizeImage
```

Generates `app/Tasks/ResizeImage.php`:

```
namespace App\Tasks;

use Mpge\Govel\Contracts\Task;

class ResizeImage implements Task
{
    public function name(): string
    {
        return 'resize-image';
    }
}
```

### govel:make-worker

[](#govelmake-worker)

```
php artisan govel:make-worker resize-image
```

Creates `bin/workers/resize-image/` with a Go template that reads JSON from stdin and writes JSON to stdout.

### govel:build

[](#govelbuild)

```
# Build a specific worker
php artisan govel:build resize-image

# Build all workers
php artisan govel:build
```

Compiles Go source in `bin/workers/*/` to binaries in `bin/`. Requires Go to be installed.

### govel:list

[](#govellist)

```
php artisan govel:list
```

Outputs a table showing each task name, its binary path, and whether the binary exists.

Drivers
-------

[](#drivers)

Govel ships with three drivers. Set `GOVEL_DRIVER` in your `.env`:

DriverUse CaseHow It Works`process` (default)Simple, single-serverSpawns a Go binary per task via Symfony Process`grpc`Persistent server, zero startup overheadHTTP/JSON bridge to a long-running Go server`distributed`Multi-node, high availabilityLoad-balanced requests across multiple Go servers### Process Driver

[](#process-driver)

The default. Each task spawns a Go binary, communicates via stdin/stdout JSON.

```
GOVEL_DRIVER=process
GOVEL_BIN_PATH=/path/to/bin
GOVEL_TIMEOUT=30
```

### gRPC Driver

[](#grpc-driver)

Connects to a persistent Go server — no process startup cost per task. Uses HTTP/JSON (no PHP extensions required).

```
GOVEL_DRIVER=grpc
GOVEL_GRPC_HOST=127.0.0.1
GOVEL_GRPC_PORT=9800
```

Start the included Go server:

```
cd bin/workers/govel-server
go build -o ../../govel-server .
GOVEL_PORT=9800 GOVEL_BIN_PATH=../../ ../../govel-server
```

### Distributed Driver

[](#distributed-driver)

Load-balances tasks across multiple Govel server nodes with automatic failover.

```
// config/govel.php
'driver' => 'distributed',
'distributed' => [
    'strategy' => 'round-robin', // or 'least-connections'
    'nodes' => [
        ['host' => '10.0.0.1', 'port' => 9800],
        ['host' => '10.0.0.2', 'port' => 9800],
        ['host' => '10.0.0.3', 'port' => 9800],
    ],
],
```

Queue Integration
-----------------

[](#queue-integration)

Dispatch Go tasks onto Laravel queues:

```
// Basic queue dispatch
Govel::queue(ProcessImage::class, ['path' => '/tmp/img.jpg']);

// With options
Govel::queue(ProcessImage::class, $payload)
    ->onQueue('processing')
    ->onConnection('redis')
    ->delay(60)
    ->via('grpc');  // Use a specific Govel driver
```

Go Worker Contract
------------------

[](#go-worker-contract)

Every Go binary must:

1. **Read JSON from stdin** — the payload from PHP
2. **Write JSON to stdout** — the response back to PHP
3. **Exit 0** on success, non-zero on failure
4. **Write errors to stderr** — captured for logging

Result DTO
----------

[](#result-dto)

```
$result = Govel::run(ProcessImage::class, $payload);

$result->success;   // bool
$result->output;    // array (decoded JSON from Go)
$result->error;     // string|null
$result->duration;  // float (milliseconds)
```

Error Handling
--------------

[](#error-handling)

```
use Mpge\Govel\Exceptions\BinaryNotFoundException;
use Mpge\Govel\Exceptions\TaskExecutionException;

try {
    $result = Govel::run(ProcessImage::class, $payload);
} catch (BinaryNotFoundException $e) {
    // Binary not found at expected path
} catch (TaskExecutionException $e) {
    // Process timed out or failed
}

if (! $result->success) {
    logger()->error($result->error);
}
```

Extending with Custom Drivers
-----------------------------

[](#extending-with-custom-drivers)

```
Govel::extend('custom', new MyCustomDriver());
Govel::driver('custom')->run($task, $payload);
```

Architecture
------------

[](#architecture)

```
Laravel (PHP)
  → Govel Facade
    → GoManager
      ├── ProcessDriver  → Go binary (stdin/stdout)
      ├── GrpcDriver     → Go HTTP server (persistent)
      └── DistributedDriver → Multiple Go servers (load balanced)
          → Result DTO

```

Configuration Reference
-----------------------

[](#configuration-reference)

```
// config/govel.php
return [
    'driver'  => env('GOVEL_DRIVER', 'process'),
    'bin_path' => env('GOVEL_BIN_PATH', base_path('bin')),
    'timeout'  => env('GOVEL_TIMEOUT', 30),

    'grpc' => [
        'host' => env('GOVEL_GRPC_HOST', '127.0.0.1'),
        'port' => env('GOVEL_GRPC_PORT', 9800),
        'tls'  => env('GOVEL_GRPC_TLS', false),
    ],

    'distributed' => [
        'strategy' => env('GOVEL_DIST_STRATEGY', 'round-robin'),
        'tls'      => env('GOVEL_DIST_TLS', false),
        'nodes'    => [],
    ],

    'queue' => [
        'connection' => env('GOVEL_QUEUE_CONNECTION'),
        'queue'      => env('GOVEL_QUEUE_NAME', 'govel'),
    ],
];
```

Govel Monitor
-------------

[](#govel-monitor)

 [ ![Govel Monitor — real-time task monitoring dashboard](art/govel-monitor.png) ](https://github.com/mpge/govel-monitor)

Track every Go task execution with a real-time dashboard. Zero code changes — just install and go.

```
composer require mpge/govel-monitor
php artisan migrate
```

Visit `/govel-monitor` to see your dashboard. [Learn more →](https://github.com/mpge/govel-monitor)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance93

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

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

2

Last Release

34d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f1e8418623e51236a1fd63d1da722d2b15a8a8b067b10d520580fd3e9a6e509?d=identicon)[MatthewGross](/maintainers/MatthewGross)

---

Top Contributors

[![mpge](https://avatars.githubusercontent.com/u/3311227?v=4)](https://github.com/mpge "mpge (20 commits)")

---

Tags

laravelperformanceprocessTasksgogolang

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mpge-govel/health.svg)

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M224](/packages/laravel-horizon)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M368](/packages/laravel-zero-framework)[jackwh/laravel-new-relic

Monitor your Laravel application performance with New Relic

112827.2k](/packages/jackwh-laravel-new-relic)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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