When to create a package

Create a new package when you’re building a self-contained business domain with its own models, routes, and business logic. Examples:
  • Reporting module
  • Notification system
  • Integration with a third-party service
For smaller features that extend an existing domain, add to the existing package instead.

Step 1: Create the directory structure

Step 2: Create composer.json

Step 3: Create the ServiceProvider

Step 4: Define routes

Step 5: Create the model

Step 6: Create migration

Step 7: Create policy

Step 8: Create controller and service

Follow the Service Layer pattern — keep controllers thin and delegate to services.

Step 9: Register the package

Add to the root composer.json:
Then install:

Step 10: Run migrations

Package checklist

  • composer.json with proper namespace and autoload
  • ServiceProvider registered via Laravel auto-discovery
  • Routes use exowpee.teams plus the complete access group for their context
  • Models using KsuidTrait
  • Policies using BeforePolicyFilterTrait
  • FormRequests extending RestApiFormRequest
  • Resources for response formatting
  • Migrations with company_id/organization_id columns
  • Translations in en and fr
  • Contract interface for cross-package communication