- How do I install roundly-consulting/addresses-for-laravel?
- Install it with Composer using composer require roundly-consulting/addresses-for-laravel. The package follows standard Laravel conventions, so its service provider is registered through package auto-discovery and no manual wiring is documented. After installing, publish the configuration and run the migrations so the addresses table exists. Because the package pins roundly package-toolkit ^1.3.0, run a composer update --dry-run first if your app already uses other roundly packages.
- Which Laravel and PHP versions does this package support?
- The package is a conventional Laravel library with a service provider and config publishing, but its explicit Laravel and PHP version matrix is not stated in the release notes. In practice the PHP floor is set by its dependency on roundly package-toolkit ^1.3.0 rather than by this package alone. If you run several Laravel majors, test against each target version yourself instead of assuming the package's own CI covers it.
- How do I attach an address to a User or Order model?
- Add the package's polymorphic addressable trait to any Eloquent model, such as User, Company, or Order. The trait exposes the relationship so the model can own one or more address records without duplicating address columns in your own tables. You then create addresses through the provided address model and its relationship methods. Fields cover street, city, region, postal code, and country.
- Can a single model have multiple addresses?
- Yes. The relationship is a polymorphic one-to-many, so a user, company, or order can hold several address records, for example a billing and a shipping address. Because the link is polymorphic, the same address table serves every model type in your application. You can query addresses from either side of the relationship using standard Eloquent methods.
- Can I swap the address model or change the table name?
- Yes. The package is designed with configurable table names and swappable models, so you can point it at your own address model or a differently named table. This is useful when your application already has address conventions or naming standards to follow. Check the published config file after installation to see which keys control the table and model bindings.
- Does the package include address validation and formatting helpers?
- Yes. It ships validation rules and formatting helpers alongside the model and migration, plus country data for standard country fields. The helpers let you render a stored address consistently instead of reformatting street, region, and postal code in every view. Validation rules can be reused in form requests or controllers when creating and updating addresses.
- What changed in version 1.0.2 of addresses-for-laravel?
- The 1.0.2 release notes describe dependency maintenance rather than new features, fixes, or deprecations. Specifically it pins roundly package-toolkit to ^1.3.0, raising the minimum version of that shared internal dependency. Confirm in the diff before upgrading, but the changelog suggests it is a dependency floor bump rather than a behaviour change.
- Will package-toolkit ^1.3.0 conflict with my other roundly packages?
- It can. If another roundly package in the same application constrains package-toolkit below 1.3.0, Composer will fail to resolve, which is the most likely install-time blocker. Run composer update --dry-run in the target application before merging to surface resolution conflicts cheaply. Also check that the published config keys and migration table names do not collide with existing ones.
- Is addresses-for-laravel production ready, and does it have a test suite?
- At 1.0.x the public API is not yet stabilised in practice, and minor bumps may still shift behaviour. Release notes so far cover dependency maintenance only, so the package's capability scope and API surface remain unverified. A documented test suite you can run against your own Laravel and PHP matrix is not confirmed. Treat it as installable but unevaluated until a spike in a low-risk service confirms what it does for you.
- What are the alternatives to using this package?
- The main alternative is writing your own polymorphic addresses table with a morphMany relationship, which is straightforward in Laravel and avoids an extra dependency. That may also be preferable if you already have in-house address handling that this package would duplicate. Choose the package when you want migrations, country data, validation rules, and formatting helpers ready-made and are comfortable adopting the roundly package-toolkit dependency.