Testing a Composer package against a real Laravel app is slower than it should be. You do not just run the tests: you first rewire the app so it uses your working copy.
The manual way
- Add a path repository to the app's composer.json.- Require the package as @dev.- Run composer update and test.- Undo the repository entry and restore the version constraint before you commit.Step 4 is the one people forget, and it is how a path repository ends up in a real project. Composer documents path repositories in its repositories reference [1]. ## The one-command way Laralink is a Laravel dev tool that does the whole round trip. Install it as a dev dependency: composer require amjadiqbal/laralink --dev It adds three artisan commands: laralink:dev, laralink:list and laralink:publish.
- Checks first. It compares the package's PHP and Laravel constraints with your app, using Composer's semver rules, before it touches anything.- Links your working copy. The package is linked into ./packages, so vendor/ points at the code you are editing.- Cleans up after itself. If the install fails, composer.json is restored and the link or clone is removed. Removing a symlinked package only removes the symlink.- Puts the constraint back. laralink:publish restores your exact previous constraint, for example ^2.3 in require-dev.## Requirements PHP 8.3+, Laravel 12 or 13, Composer 2 and Git. MIT licensed. ## Links Documentation and demo: https://urlshortly.com/TKDSi Source code: https://urlshortly.com/yLUuB ## References [1] Composer documentation, Repositories, Path: https://getcomposer.org/doc/05-repositories.md#path How do you test packages in a real app today? Tell me in the comments.
