edyspider/laravel-10-starter-kit
A starter kit for Laravel 10 that bundles common scaffolding for new projects, offering a baseline app structure to build on. Documentation is minimal and community adoption is low, so review the source before relying on it in production. Best suited to developers wanting a quick, opinionated Larave...
This release adds the package's core Address Information feature, so treat v1.1.0 as the first version where you actually have something to use.
Install and publish.
composer require <vendor>/<package>
php artisan vendor:publish --provider="<Vendor>\<Package>\<Package>ServiceProvider"
Publish tags are usually config, migrations, and sometimes views/lang. Publish migrations before running anything.
Run the migration — this is the headline change.
php artisan migrate
The release notes call this out explicitly. The new address table(s) are the entire feature; without this step the package's models will throw "table not found" the moment you touch an address.
Look here first, in this order:
database/migrations/*_create_addresses_table.php — column names, nullability, and whether the owner relation is a foreignId, morphs, or a plain nullable index. This determines your whole integration shape.config/<package>.php — country list source, table names, model bindings, formatter options.Address model (or contract) and any HasAddress trait / addresses() relation.First use case. Attach an address to an existing model and render it:
// on User, Order, etc.
use Vendor\Package\Concerns\HasAddress;
class Order extends Model
{
use HasAddress;
}
$order->address()->create([
'line_1' => '1 Main St',
'city' => 'Springfield',
'postcode' => '12345',
'country' => 'US',
]);
echo $order->address->formatted; // or the package's formatter helper
Confirm the exact attribute names against the migration before writing this into your app — they are the contract you'll live with.
Deployment sequence. Because v1.1.0 is migration-driven, wire it into your release pipeline in a fixed order: composer install → php artisan migrate --force → php artisan config:cache → queue:restart. Running config:cache before the migration is fine, but running it before publishing the config is not.
Treat the address as normalized data, not a blob. Store line_1/line_2, city, region, postcode, country (ISO 3166-1 alpha-2), and keep a derived formatted accessor for display. This keeps you able to filter by country/region later without a data migration.
Pick single vs. multiple addresses deliberately. If the package ships a polymorphic relation, you get "many addresses per model" for free — in that case add your own is_default boolean with a partial unique index, rather than assuming the package handles default selection:
$table->boolean('is_default')->default(false);
$table->unique(['addressable_type', 'addressable_id', 'is_default']);
(Adjust or drop for MySQL, which doesn't support partial indexes.)
Validate at the edge, not in the model. Use FormRequest validation for address input and keep the package's model as a plain persistence object. Country/region validation is best driven from the package's config/DB list rather than a hand-written in: rule.
Wrap it in an API Resource. Address columns will change between package versions more readily than your public JSON contract:
class AddressResource extends JsonResource
{
public function toArray($request): array
{
return [
'line_1' => $this->line_1,
'city' => $this->city,
'postcode' => $this->postcode,
'country' => $this->country,
'formatted'=> $this->formatted,
];
}
}
Eager load when formatting. Formatted output often resolves country/region labels. On an index of 50 orders this is a classic N+1:
Order::with('address')->paginate();
Testing. Use RefreshDatabase so the new migration runs, and build addresses through a factory if the package ships one. If you test on SQLite in-memory, watch for MySQL-only column types in the migration (see gotchas).
Multi-tenant / soft deletes. If your models are soft-deleted, an address row can be orphaned. Either cascade on delete at the DB level or add the package's model to your pruning strategy. If the package doesn't support soft deletes on addresses, don't add the column yourself — it will fight the package's queries.
php artisan migrate leaves you with a class that references a nonexistent table. Every "address information not working" report after this upgrade starts here.morphs('addressable'), the combined index on (addressable_type, addressable_id) can exceed the index length limit on older MySQL with utf8mb4. Check the generated migration and, if needed, set Schema::defaultStringLength(191) or a shorter morph key.vendor:publish overwrites. On an existing install, publish with --force only for config after diffing it, and never re-publish a migration that has already run in production — it will be skipped or, worse, duplicated under a new timestamp.php artisan config:clear before debugging.address attribute is an array. It may be cast to a DTO or value object. $model->address['city'] failing with "Cannot use object as array" is the usual symptom — check $casts and the accessor first.json support differ. If your CI runs SQLite, add one job against your production engine before trusting the migration.How can I help you explore Laravel packages today?