Skip to content

feat: add query collection and streaming PHP execution#22

Open
ILDaviz wants to merge 5 commits into
mainfrom
feature/update-client
Open

feat: add query collection and streaming PHP execution#22
ILDaviz wants to merge 5 commits into
mainfrom
feature/update-client

Conversation

@ILDaviz

@ILDaviz ILDaviz commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

  • Add database query collection for Laravel and Symfony/Doctrine projects
  • Add streaming PHP execution with output, statement lifecycle, and error events
  • Improve Composer, Symfony, and plain PHP loader handling
  • Add test coverage for loaders, query collection, streaming, and CLI errors

Testing

  • vendor/bin/phpunit

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the TweakPHP Client PHAR runtime by adding database query instrumentation (Laravel + Symfony/Doctrine) and introducing a streaming execution mode that emits structured lifecycle/output/error events during PHP execution.

Changes:

  • Add QueryCollector + framework-specific query providers and attach them in Laravel/Symfony loaders.
  • Add execute-stream command and streaming execution plumbing (including StreamingOutput and new event protocol).
  • Expand CI/tooling and add PHPUnit coverage for loaders, query collection, streaming behavior, and CLI error handling.

Reviewed changes

Copilot reviewed 27 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/TinkerTest.php Adds unit tests covering non-stream and streaming execution semantics (statements, output, errors, exit codes).
tests/QueryCollectorTest.php Adds tests for Laravel and Symfony/Doctrine query collection plus instrumentation error reporting.
tests/OutputModifierTest.php Adds tests ensuring output modifier preserves marker text and normalizes indentation.
tests/LoaderTest.php Adds tests for loader detection/boot across Laravel, Symfony, WordPress, Pimcore, Composer, and plain PHP.
tests/CliTest.php Adds tests for CLI argument parsing and runtime error reporting for execute.
src/Tinker.php Implements per-statement parsing/execution, query collection, and a new streaming execution API.
src/OutputModifiers/CustomOutputModifier.php Simplifies output modification (removes end-marker truncation; keeps indentation normalization).
src/Output/StreamingOutput.php Introduces an Output implementation that streams chunks to a callback while filtering PsySH newline markers.
src/Loaders/WordPressLoader.php Minor cleanup in version() exception handling.
src/Loaders/SymfonyLoader.php Improves kernel-class discovery and registers Symfony/Doctrine query provider via the container.
src/Loaders/PlainPhpLoader.php Stops changing CWD in constructor; executes within project directory and restores working directory.
src/Loaders/LoaderInterface.php Updates streaming execution signature to accept an event callback.
src/Loaders/LaravelLoader.php Registers Laravel query provider during loader construction.
src/Loaders/ComposerLoader.php Avoids re-loading a project’s Composer autoloader if it appears already loaded.
src/Loaders/BaseLoader.php Passes the streaming event callback through to Tinker.
src/Database/SymfonyDoctrineQueryProvider.php Adds Symfony/Doctrine query provider supporting multiple Doctrine query-logging strategies.
src/Database/QueryProviderInterface.php Defines provider contract for starting/stopping query collection.
src/Database/QueryCollector.php Adds provider orchestration, query aggregation, and de-duplicated instrumentation error recording.
src/Database/LaravelQueryProvider.php Adds Laravel DB::listen-based query collection gated by start/stop state.
README.md Documents commands, streaming protocol, supported projects, build process, and error/result formats.
Makefile Adds a reproducible PHAR build target that installs prod deps and compiles with a pinned Box version.
LICENSE.md Removes the repository license file.
index.php Refactors CLI: adds execute-stream, strict command validation, safer base64 decoding, structured error handling, and streaming event output.
composer.lock Updates locked dependencies (including psy/psysh + php-parser) and adds dev dependencies (phpunit, pint).
composer.json Adds package metadata, pins dependency constraints, and adds dev tooling + test script/autoload-dev.
box.json Removes Box configuration file.
.gitignore Tidies ignores and adds phpunit cache and e2e output ignores.
.github/workflows/tests.yml Adds a PHP matrix CI workflow running PHPUnit.
.github/workflows/release.yml Updates release pipeline to build PHARs via Makefile and upload via softprops/action-gh-release.
.github/workflows/code-style.yml Runs Pint from vendor/bin and executes tests in the code-style workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Tinker.php
Comment thread tests/TinkerTest.php
Comment thread composer.json
@ILDaviz ILDaviz self-assigned this Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants