rodion-arr/laravel-mysql-stored-procedures

A service for calling MySQL stored procedures with multiple data sets

v2.0.0 2021-04-30 22:28 UTC

This package is auto-updated.

Last update: 2025-01-09 20:00:09 UTC


README

PHP Composer codecov Latest Stable Version License

Motivation

Laravel's DB facade does not support calling stored procedures that returns multiple data sets in result out of the box. This package provides a simple service for calling and retrieving MySQL stored procedures by name and getting all its returned datasets back.

Based on @tommyready's PDOService class. Refactored, covered with unit tests and issued as Composer package from my side.

Installation

composer require rodion-arr/laravel-mysql-stored-procedures

Usage

require_once __DIR__.'/vendor/autoload.php'; // Autoload files using Composer

use RodionARR\PDOService;
use Illuminate\Support\Facades\App;

/**
@var PDOService $service
*/
$service = App::make(PDOService::class);
$multipleRowsets = $service->callStoredProcedure('store_procedure_name', ['param1', 'param2', '....']);

dd($multipleRowsets);