Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Reactsh Laravel Package

davidcole1340/reactsh

Reactsh provides a lightweight Laravel/PHP bridge for working with React and modern frontend tooling. It aims to simplify integrating React components into server-rendered apps with straightforward setup and sensible defaults for local development and builds.

View on GitHub
Deep Wiki
Context7

Getting Started

reactsh is a minimal ReactPHP-based REPL (Read-Eval-Print Loop) for interactive PHP development using async programming patterns. To start:

  1. Install via Composer: composer require davidcole1340/reactsh --dev
  2. Run from CLI: ./vendor/bin/reactsh
  3. Begin typing PHP code — including async constructs like promises — and see immediate results.

It’s designed for quick experimentation (e.g., testing HTTP clients, event loops, or timers), not production usage. Start by trying basic async commands:
$loop = React\EventLoop\Factory::create();
$loop->addTimer(1, fn() => echo "Hello\n");

Implementation Patterns

  • Async Prototyping: Use reactsh to quickly prototype asynchronous workflows before committing to a full script or CLI app.
  • Integration Testing Aid: Interactively test Laravel Horizon jobs, HTTP clients (e.g., guzzlehttp/promises), or database connection pools with real-time feedback.
  • Loop Inspection & Debugging: Inspect the active event loop ($loop), pending timers, streams, or watchers — helpful for diagnosing stalls in async apps.
  • Quick CLI Tools: Though limited, you can build simple one-off CLI tools interactively (e.g., poll an API, transform data, output JSON).

Tip: Combine with Laravel’s artisan tinkerreactsh focuses on async primitives, while Tinker handles Eloquent/state.

Gotchas and Tips

  • No Built-in Autocomplete or History: Unlike psy/psysh, there’s no readline support or command history by default (depending on environment). On Unix, try rlwrap vendor/bin/reactsh to add line editing/history.
  • Promises Require Manual Resolution: You’ll often need to call $loop->run() explicitly after creating a promise to see side effects — otherwise, code silently exits after reactsh starts the loop.
  • Silent Failures: Exceptions inside timers or async callbacks may not bubble to the REPL prompt. Use try/catch and var_dump() liberally during debugging.
  • Version Lock: Last updated in 2022 — verify compatibility with modern ReactPHP versions (react/event-loop:^1.4). Consider reactphp/react’s own REPL (reactphp/repl) for more recent support.
  • Extend via require: You can inject custom helpers by prepending a bootstrap file: reactsh -d auto_prepend_file=helpers.php — useful for adding Laravel bootstrapping or utility functions.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport