Weave 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

Contract Laravel Package

rapira/contract

Shared contracts and interfaces for the Rapira Laravel ecosystem. rapira/contract provides stable abstractions that keep packages decoupled and make it easier to build extensible, maintainable applications. Depend on contracts instead of concrete implementations for cleaner, more portable code.

View on GitHub
Deep Wiki
Context7

PHP contracts for Rapira

Frequently asked questions about Contract
What is rapira/contract used for in Laravel?
rapira/contract provides reusable contracts and interfaces for services and domain objects in Laravel and PHP applications. It helps you depend on abstractions instead of concrete implementations so components are easier to swap, test, and maintain. The package is aimed at keeping package boundaries explicit and reducing coupling between Laravel components.
How do I install rapira/contract with Composer?
Install it with Composer using composer require rapira/contract. The package is lightweight and the overview describes minimal configuration. After installation, check the package namespace and whether it auto-discovers any service provider before wiring it into your adapter layer.
Does rapira/contract work with Laravel's service container?
Yes, the package overview says it works cleanly with Laravel's service container. That makes it suitable for binding contract implementations in a service provider. Confirm the exact binding mechanism and any auto-registration in the package source before relying on it in production.
Which Laravel and PHP versions does rapira/contract support?
The provided excerpt does not list exact PHP or Laravel version constraints. Because the package is at 0.9.1, check its composer.json for declared php and illuminate/* requirements before installing. Test against your application's Laravel version rather than assuming broad compatibility.
How should I test code that depends on rapira/contract?
Keep your domain and application code behind your own port interfaces, then use test-only bindings or constructor injection to supply fakes or the package's runtime double. If the double is selected by configuration, make test selection explicit and fail-closed outside the test environment. Add integration tests that exercise the real adapter separately from unit tests that use the double.
What is the runtime double in rapira/contract?
The 0.9.1 evaluation notes describe a runtime double that lets stub functions answer during tests. It is a testing seam for verifying code that calls Rapira contracts without requiring the real transport or implementation. Treat it as test infrastructure and keep it out of domain and application-layer code.
Is it safe to use rapira/contract's test double in production?
No, a runtime double that returns fabricated answers should not be active in production. Verify whether the double ships in the production autoload path and whether it is guarded by a test-only binding or configuration flag. If a flag controls it, add a deployment assertion that the flag is off outside tests.
Does rapira/contract register a service provider or facade?
The excerpt does not confirm whether the package registers a Laravel service provider, facade, or global helper. Its stub resolution may use container binding, a static registry, or constructor injection, so inspect the source before adoption. Auto-discovery and any global surface should be verified in a clean Laravel install.
Is rapira/contract stable enough for production at version 0.9.1?
Version 0.9.1 is pre-1.0, so treat the API as unstable and expect possible breaking changes in 0.9.x feature releases. The package has a single maintainer and little evidence of Laravel adoption, so you may be an early integrator. Pin the version, review changes, and isolate it behind adapter interfaces before production use.
What are alternatives to rapira/contract for Laravel contracts?
For many Laravel applications, plain PHP interfaces plus Laravel's service container are enough to define contracts and swap implementations. If you need shared abstractions across packages, use small first-party contracts or a more established interface package. Evaluate rapira/contract specifically when you need its Rapira ecosystem stubs and testing double.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource