torann/modules
Torann Modules provides a lightweight way to organize Laravel applications into reusable, self-contained modules, with support for service providers, routes, views, and configuration so larger projects stay structured and maintainable.
Install and pin the version. This is a 0.1.x package, so treat the API as unstable. Require it with a tight constraint (^0.1.1) and read the changelog before every minor bump.
Publish the config first. Run the package’s publish command (typically php artisan vendor:publish --provider="Vendor\Package\PackageServiceProvider" or a specific --tag=config). Release 0.1.1 fixes config publishing, so if a previous publish silently produced no config file, upgrade and republish before debugging anything else.
Read config/<package>.php before writing code. The important knobs are the stub path, migration settings, and tenant connection/identifier options. This file tells you what the package expects more reliably than the README.
Pick one first use case. Either:
--tenant=<identifier> against a single tenant.The tenant migration path is the fastest way to confirm the package is wired to the right database connection.
Stub customization as a first-class workflow. With the more flexible stub system in 0.1.1, publish stubs into your app (e.g. stubs/vendor/<package>) and point the config’s stub path there. Keep customized stubs in version control. Only override the stubs you actually change; let the package defaults handle the rest so upgrades stay small.
Config publishing per environment. Publish the config into config/ and drive values through .env. Do not edit files under vendor/. In CI, run the publish step during build/setup, then php artisan config:clear so the new file is picked up.
Tenant migrations in deploy scripts. Use the new --tenant option to migrate one tenant at a time. A typical deploy loop creates or selects a tenant, runs the package migration command with --tenant=<id>, checks the exit code, and moves on. Run central/shared migrations before tenant migrations. For local development, provision a single test tenant and migrate just that one rather than looping all tenants.
Custom artisan wrappers. If the package’s command signature is still settling, wrap it in your own command (e.g. tenants:migrate-all) that enumerates tenants and calls the package command per tenant. That isolates your deploy scripts from future signature changes.
Testing. Use the package’s test stubs if provided, assert generated files after running generators, and migrate a dedicated test tenant in setUp(). Keep central and tenant database setup separate so failures point to the right connection.
Provisioning integration. Trigger tenant migrations from your tenant-created/provisioned event or job, not only from manual CLI runs. That keeps new tenants consistent with existing ones.
vendor:publish does not overwrite existing files. If you published a broken/partial config before 0.1.1, the fixed version will not replace it. Delete the old config (or use --force deliberately) and diff before committing.php artisan config:clear (and config:cache in production). A stale cache looks exactly like “the publish bug is still there.”--tenant expects an ID, slug, or domain, and whether it validates existence. Migrating a non-existent tenant can fail late or, worse, fall back to the central connection.--force equivalent in deploy scripts and guard against running tenant migrations against the wrong environment.How can I help you explore Laravel packages today?