- How do I install mateusjunges/laravel-invite-codes in a Laravel app?
- Install it with composer require mateusjunges/laravel-invite-codes, then publish and run the package migrations so the invite codes table exists. The service provider is auto-discovered, so there is no manual registration step. Finally, add the package trait to the model that should issue codes, typically your User model, and wire the create, validate, and redeem calls into your controllers or form requests.
- Which Laravel versions does laravel-invite-codes support?
- Version 2.4.0 adds support for Laravel 13 by widening the illuminate/* constraint, and existing supported versions remain supported. The package line has historically tracked recent Laravel majors, so it fits teams on a current-major upgrade cadence. If your application runs an older major, pin to the release that matches your framework rather than forcing the newest constraint.
- Can invite codes expire or be limited to a maximum number of uses?
- Yes. Codes can be created with an expiration date and a maximum usage count, which covers time-boxed beta invites as well as multi-use referral or campaign codes. Each redemption is recorded against the code, so you can report on how often a given code was used.
- Can I associate an invite code with a user or another Eloquent model?
- Codes can be associated with a user or another model, which lets you attribute a code to the person or entity that issued it. Redemptions are persisted, so you can see which codes were used and how many times. That gives you the raw data for referral reporting, while reward issuance stays in your application.
- Are single-use invite codes safe under concurrent redemption requests?
- The package generates and persists codes, but atomic redemption is your responsibility. Redeem single-use and usage-capped codes inside a database transaction that locks the code row, for example with lockForUpdate, before checking remaining usage and writing the redemption record. Verify whether uniqueness and max-usage limits are enforced at the database level in your schema and back them up in your own redemption service.
- Do I need to publish migrations or register the service provider manually?
- You publish the package migrations and run php artisan migrate as part of your normal deployment. The service provider is auto-discovered, so no manual registration is required. The install is additive, so there is no data backfill unless you are migrating existing invite codes out of a bespoke table.
- Should I use this package or build invite codes myself?
- Adopt it when invite codes need to be a first-class entity with quotas, expiry, attribution, and multi-use tracking, such as beta signups, referrals, or gated registration. If you only need a one-off registration gate, a hand-rolled column plus a validation rule is cheaper than adding a dependency. Integration effort is measured in days and is dominated by product decisions about who can issue codes and what limits apply.
- Does upgrading to version 2.4.0 require code changes?
- Version 2.4.0 is a single change that adds Laravel 13 support by widening the illuminate/* constraint. No deprecations, removals, or behavioral changes are called out, so code changes are not expected. Still treat it as a normal dependency bump and run your CI suite, because the widened constraint can change which transitive dependency versions the resolver picks in an app that is not yet on Laravel 13.
- What are the maintenance risks of depending on laravel-invite-codes?
- The package has a narrow maintainer and contributor pool and no vendor SLA, which is the main structural risk rather than anything in a specific release. Keep your exposure small by wrapping code creation and redemption in your own service class so a fork or replacement touches one place. Also confirm which Laravel versions your fleet actually runs before relying on the newest constraint.
- Does laravel-invite-codes handle referral attribution and rewards?
- The package stores codes with their associated model and records redemptions, which gives you the attribution data needed for who-invited-whom reporting. It does not implement reward issuance, payouts, or a complete referral program, so you model those on top of the code and redemption records. If you need full attribution and reward flows, budget for that work outside the package.