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
Requires
- php: ^7.3.0|^8.0.0
- ext-pdo: *
- illuminate/support: ~5.0|~6.0|~7.0|~8.0
Requires (Dev)
- orchestra/testbench: ~3.2|~4.0|~5.0|~6.0
- phpunit/phpunit: ^9.1
README
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);