doctrs/stored-procedure-bundle
red-defender/pgfunc, limiting its applicability to non-PostgreSQL databases. If the application relies on PostgreSQL, this could streamline stored procedure execution, but it introduces vendor lock-in.Bundle class, DependencyInjection) would require:
.env/config/ structure.pgfunc’s DBAL integration might work, but untested.red-defender/pgfunc library (last updated 2016) is outdated and lacks Laravel-specific optimizations. Risk of compatibility issues with modern PostgreSQL versions or Laravel’s DBAL.pgfunc) are abandoned. No guarantees for security updates or PostgreSQL version support.pgfunc directly in Laravel before committing to the bundle.DB::statement() or DB::select() for stored procedures?php-pg-stored-proc (more active)?Laravel Compatibility Matrix:
| Component | Compatibility Risk | Mitigation Strategy |
|---|---|---|
| Symfony Bundle | High | Create a Laravel Service Provider wrapper. |
pgfunc |
Medium | Test with Laravel’s DBAL; patch if needed. |
| PostgreSQL | Low | Native support in Laravel. |
| Doctrine DBAL | Low | Laravel already uses it. |
Recommended Stack:
doctrine/dbal (already in Laravel).red-defender/pgfunc (directly, bypassing the bundle if possible).pgfunc directly in Laravel:
use RedDefender\PgFunc\PgFunc;
$pgFunc = new PgFunc($pdoConnection);
$result = $pgFunc->call('sp_name', [$param1, $param2]);
config/stored_procedure.php.StoredProcedure::call()).class StoredProcedureServiceProvider extends ServiceProvider {
public function register() {
$this->app->singleton('pgfunc', function ($app) {
$config = $app['config']['stored_procedure'];
$pdo = new PDO(
"pgsql:host={$config['host']};dbname={$config['dbname']}",
$config['user'],
$config['password']
);
return new PgFunc($pdo);
});
}
}
config/stored_procedure.php:
return [
'connections' => [
'api_master' => [
'dbname' => env('API_DB_MASTER_DBNAME'),
'host' => env('API_DB_MASTER_HOST'),
// ...
],
],
];
pgfunc instances per connection.pgfunc calls in try-catch blocks to convert PostgreSQL errors to Laravel exceptions.pgfunc) require local patches.pgfunc for a single feature may not be justified if usage is limited.pgfunc may not integrate well with Laravel’s error pages.pgfunc errors for Laravel.PREPARE).| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
| PostgreSQL downtime | Application crashes | Implement circuit breakers; use read replicas. |
| Stored procedure bug | Data corruption | Rollback transactions; test procedures in isolation |
How can I help you explore Laravel packages today?