pingslayer/laravel-go-reports

High-performance Laravel reporting engine using an embedded Go sidecar for streaming millions of rows with zero memory bloat.

Maintainers

Package info

github.com/pingslayer/laravel-go-reports

pkg:composer/pingslayer/laravel-go-reports

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-04-17 10:20 UTC

This package is auto-updated.

Last update: 2026-04-18 06:38:29 UTC


README

Latest Version on Packagist Total Downloads License

A professional-grade reporting package for Laravel that "Tunnels" complex Eloquent queries to an embedded Go service for high-speed JSON streaming.

🚀 Installation

  1. Require the package:
composer require pingslayer/laravel-go-reports
  1. 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)
  1. Auto-Start: When Laravel boots, it detects your OS and launches the bundled Go binary in the background.
  2. Auto-Init: It sends your database credentials to the Go engine once to establish a connection pool.
  3. 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 SELECT statements.
  • 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