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

Composer Repl Laravel Package

ramsey/composer-repl

Interactive REPL for Composer projects. Quickly bootstrap a PHP shell that autoloads your dependencies and project classes, making it easy to explore APIs, test snippets, and debug in the context of your installed packages—without creating a script.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Run composer require --dev ramsey/composer-repl to install it in your project (dev-only).
  • Once installed, launch the REPL via composer repl (no extra setup required).
  • The REPL automatically loads your project’s vendor/autoload.php, giving immediate access to all installed packages and your own classes.
  • First use case: Instantly test how your project’s dependency (e.g., monolog/monolog) logs a message or how a custom utility class behaves.

Implementation Patterns

  • API Exploration: Use it to inspect method signatures, default options, or edge-case behavior (e.g., new MyService()->handle(...)) without writing and running a .php script.
  • Debugging Complex Flows: Pause mid-development to inspect $this state or intermediate values in a service—just paste in a quick variable dump or condition check.
  • Dependency Isolation: Before adding a new package, fire up composer repl and test it against your current dependency tree to catch version conflicts early.
  • Prototyping Logic: sketch and validate business rules, transform data, or simulate API responses interactively—then copy-paste working code into your codebase.

Gotchas and Tips

  • Class Autoloading Delays: If you add a new class file manually (e.g., in src/) without running composer dump-autoload, the REPL won’t find it—run composer dump-autoload after changes.
  • REPL Compatibility: Uses php://stdin and readline/linenoise; if your CLI environment lacks readline support (e.g., some Windows setups), it falls back to a basic input loop. Consider php -a as a fallback if composer repl fails.
  • Extension Point: You can add custom initialization code by creating a composer-repl.php file in your project root. It gets included before the REPL starts—perfect for preloading mocks, constants, or helper functions.
  • Avoid Production: Never install or use ramsey/composer-repl in production—it’s purely a dev tool and may leak sensitive context via interactive execution.
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