pingslayer / laravel-go-reports
High-performance Laravel reporting engine using an embedded Go sidecar for streaming millions of rows with zero memory bloat.
v1.0.0
2026-04-17 10:20 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0
README
A professional-grade reporting package for Laravel that "Tunnels" complex Eloquent queries to an embedded Go service for high-speed JSON streaming.
🚀 Installation
- Require the package:
composer require pingslayer/laravel-go-reports
- Publish the configuration:
php artisan vendor:publish --provider="LaravelGoReports\LaravelGoReportsServiceProvider" --tag="config"
🏗 Requirements
- PHP: ^8.1
- Laravel: ^10.0 | ^11.0 | ^12.0 | ^13.0
- Database: MySQL ONLY (MariaDB supported)
- Auto-Start: When Laravel boots, it detects your OS and launches the bundled Go binary in the background.
- Auto-Init: It sends your database credentials to the Go engine once to establish a connection pool.
- Tunneling: When you call
JSONReport::fromEloquent($query), the package extracts the raw SQL and Bindings and sends them to Go for execution and streaming.
📖 Usage
Using the Eloquent Tunnel
You can directly pipe either a Laravel Model or the DB Facade (Query Builder) into the engine. The Tunnel automatically extracts the underlying SQL and Bindings.
Option A: Using an Eloquent Model
use LaravelGoReports\JSONReport; use App\Models\User; return JSONReport::fromEloquent( User::join('orders', 'users.id', '=', 'orders.user_id') ->where('orders.status', 'paid') );
Option B: Using the DB Facade
use LaravelGoReports\JSONReport; use Illuminate\Support\Facades\DB; return JSONReport::fromEloquent( DB::table('reports')->where('amount', '>', 500) );
Advanced: Passing Raw SQL & Bindings
use LaravelGoReports\JSONReport; return JSONReport::generate([ 'sql' => 'SELECT * FROM reports WHERE amount > ?', 'bindings' => [500] ]);
🛠 Configuration (config/report.php)
return [ 'auto_start' => env('REPORT_ENGINE_AUTO_START', true), 'port' => env('REPORT_ENGINE_PORT', 8081), 'secret_key' => env('REPORT_ENGINE_SECRET', 'laravel-go-sync'), ];
🛡 Security
- The Go engine only permits
SELECTstatements. - Any destructive SQL (DELETE, DROP, UPDATE) is strictly blocked by a regex validator.
- Database credentials are kept secure and shared with Go only during core initialization.
📄 License
MIT