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

Contracts Laravel Package

dragon-code/contracts

Dragon Code Contracts provides a set of reusable PHP interfaces for any project, helping standardize implementations and keep code decoupled. Lightweight, framework-agnostic, and easy to install via Composer.

View on GitHub
Deep Wiki
Context7

The Dragon Code's Contracts collection

Frequently asked questions about Contracts
What is dragon-code/contracts used for in Laravel?
It provides reusable PHP interfaces for common application boundaries such as cache stores, TTLs, queues, DTOs, HTTP builders, actions, and migrations. Laravel teams use it to type-hint against stable contracts instead of framework concretes or hand-rolled interfaces. It adds no service provider, runtime behavior, or storage, so it is strictly a dependency-inversion tool.
How do I install dragon-code/contracts?
Install it with Composer using composer require dragon-code/contracts. There is no service provider to register and no configuration to publish. After installation, implement the interfaces on your existing classes or type-hint them in constructors.
Do I need to register a service provider or publish config for dragon-code/contracts?
No. The package is a pure interface collection with no bootstrapping, service provider logic, or configuration files. Integration is limited to Composer autoloading and implementing or type-hinting the contracts in your code. That also makes removal straightforward if you change direction.
Which Laravel versions does dragon-code/contracts support?
Release history shows alignment with Laravel 11 and 12, plus Symfony 6 and 7. Because the repository is archived, you should not assume future Laravel 13 support. Check the package's PHP and Symfony constraints before adopting it in a long-lived application.
Is dragon-code/contracts safe for production?
The code itself is low risk because interfaces have no runtime failure modes and no transitive blast radius beyond Composer resolution. The larger risk is lifecycle: the repository is archived, has a single-maintainer history, and will not receive security patches or compatibility updates. The MIT license lets you fork or vendor the interfaces, which materially caps that risk.
How do I test classes that implement dragon-code/contracts interfaces?
Testing is generally simple because the package contains only interfaces, so you can mock or stub them in unit tests without booting Laravel. You can also create small fake implementations for cache, queue, or HTTP contracts. Keep tests focused on your implementation's behavior rather than the interface definitions themselves.
What interfaces does dragon-code/contracts provide?
The package includes contracts around caching such as Cache\Store and Cache\Ttl, queues such as Queue\ShouldQueue and ShouldBeUnique, DTOs via Dtoable, HTTP via Http\Builder, and additional action and migration contracts. These are intended as reusable boundaries for internal packages and layered applications. Review the specific signatures before adopting because interface changes are breaking for implementers.
Can I use dragon-code/contracts without Laravel?
Yes. The package is framework-agnostic and consists of plain PHP interfaces, so it can be used in any PHP project. The strongest fit is still Laravel 11 or 12 services and internal Composer packages, especially where domain code must avoid framework concretes. Non-Laravel frameworks can use it too, but you should verify the PHP and Symfony constraints.
What are alternatives to dragon-code/contracts?
Alternatives include Laravel's own contracts, PSR interfaces such as PSR-16 for caching, or small in-house interfaces declared directly in your domain or internal packages. If you only need three or four contracts, re-declaring them in-house may be cheaper than adopting an archived dependency. Choose based on whether you need standardized reusable boundaries or just local decoupling.
Is dragon-code/contracts still maintained, and what if I need a fix?
The repository is archived, so there is no active upstream maintenance, no new Laravel or PHP compatibility releases, and no guaranteed fixes. If you adopt it, pin the version and plan ownership for a fork or vendor copy. The MIT license allows forking, and because the package is interfaces only, you can also replace it with in-house contracts if needed.
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.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style