Skip to content

Releases: kasapdev/php-query-builder

v1.3.0

Choose a tag to compare

@kasapdev kasapdev released this 07 Sep 20:01

Added

  • Subquery support for where() / andWhere() / orWhere(): pass a nested QueryBuilder
    instance as a condition value and it compiles to a parenthesized (SELECT ...) subquery, with
    the subquery's own bindings merged into the parent's bindings array in the exact left-to-right
    order they appear in the rendered SQL.
    • Primary supported pattern: WHERE ... IN (subquery), e.g.
      where('id', 'IN', QueryBuilder::table('orders')->select(['user_id'])->where('total', '>', 100))
      compiles to `id` IN (SELECT `user_id` FROM `orders` WHERE `total` > ?) with the subquery's
      bindings correctly appended after any preceding outer bindings.
    • A subquery also works as a plain scalar comparison value (where('id', '=', $subquery))
      via the same detection path.
    • Extends the library's core "never interpolate a value into raw SQL" guarantee recursively to
      nested queries, with new regression tests (including a malicious-value-inside-a-subquery
      case and real SQLite execution of a subquery-bearing query) in tests/run.php.

See CHANGELOG.md and the new "Subqueries" section in README.md for details and examples.

v1.1.0

Choose a tag to compare

@kasapdev kasapdev released this 06 Sep 01:18

Adds edge-case regression tests: raw SQL expression passthrough in select(), dotted wildcard quoting (table.*), variadic groupBy() with multiple columns, orderBy() rejecting invalid directions, insert()/update() rejecting empty data, and IN with a scalar value. No behavioral changes; all tests pass.

v1.0.0

Choose a tag to compare

@kasapdev kasapdev released this 05 Sep 23:40

Initial stable release.