beeflow/sqlquerymanager
Simple SQL query manager for PHP/Symfony. Load SQL from files and safely inject parameters using typed placeholders (string, int, secureString, email, etc.), with support for custom vartypes via service tags. Use as a Symfony service or via the SQLQuery class.
AppKernel.php and services.yml references), making direct integration with Laravel 8/9+ non-trivial without abstraction layers. The package lacks Laravel-specific service container integration (e.g., no bind()/singleton() usage).{value->secureString}), which aligns with Laravel’s query builder but introduces duplication (since Laravel already has prepared statements via Eloquent/Query Builder).VarType classes (e.g., secureString, email) provide runtime validation, but Laravel’s type system (PHP 7.4+ typed properties, interfaces) could replace this with less boilerplate.services.yml with Laravel’s bind() in AppServiceProvider).SELECT * FROM users WHERE email = {email->email}) to Laravel’s DB::table()->where() or Eloquent.database/queries/) would need adaptation for the package’s directory-based approach.StrictMode support, no PSR-15 middleware integration).VarType classes require manual validation logic (e.g., VAT checks), which could introduce SQL injection if misconfigured.VarType classes integrate with Laravel’s validation (e.g., Validator facade)?services.yml → Laravel’s bind()/tag().config/sqlquerymanager.php) support.Phase 1: Proof of Concept
// app/Providers/SQLQueryManagerServiceProvider.php
public function register()
{
$this->app->bind('sql.query.manager', function ($app) {
$manager = new \Beeflow\SQLQueryManager\SQLQueryManager();
$manager->setSqlDirectory(storage_path('queries'));
return $manager;
});
}
app('sql.query.manager')->sqlExample([...])).Phase 2: Query Builder Bridge
// app/Facades/SQLQueryFacade.php
public function execute(string $template, array $params)
{
$rawSql = $this->manager->getQuery($template, $params);
return DB::select($rawSql); // Risk: No parameter binding!
}
Phase 3: Custom VarType Integration
Validator to use VarType classes:
Validator::extend('secure_string', function ($attribute, $value, $parameters, $validator) {
return (new \Beeflow\SQLQueryManager\VarTypes\SecureString())->validate($value);
});
create_function() (if used internally).VarType casting.DB::enableQueryLog()).App\Exceptions\Handler integration.whoops or telescope.Log facade or structured logging.{value}) if VarType validation fails.value2 = 'ddd' → Casts to 0 (integer), breaking business logic.Validator rules for critical fields.setSqlDirectory() hardcoded in multiple services.config() binding.VarType class creation.VarType edge cases (e.g., empty strings, null).How can I help you explore Laravel packages today?