بنقرة واحدة
dto-contract
Defines DTO structure, lifecycle, and transformation rules across the application
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Defines DTO structure, lifecycle, and transformation rules across the application
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Ensures correct execution order of migrations, seeders, and tests in CI
Handles Filament multi-tenancy: tenant scoping, TenantAware trait, observer behaviour, isScopedToTenant, and tenant switching. Activates when adding tenant-aware models, fixing company_id scoping, working with Filament::getTenant, debugging tenant isolation, or when the user mentions company scope, tenant, multi-tenancy, or company_id.
Configures Filament panel providers. Activates when adding a new panel, registering module resources in a panel, configuring tenant middleware, adjusting auth or theme settings, or when the user mentions PanelProvider, viteTheme, discoverResources, or panel configuration.
Defines the Filament v4 resource page structure used in this project: Resource + Pages + Schemas + Tables split, action patterns, and BaseResource conventions.
Creates and modifies code inside a modular Laravel structure. Targets internachi/modular (modules as real Composer packages with src/). Activates when adding a new module, adding a model/factory/migration/resource/service to an existing module, registering a module with Filament, or when the user mentions modules, modular, or a specific module name.
Works with models that have non-standard primary key names. Activates when writing factories, tests, relationships, or seeders for models that use a custom primary key instead of id.
| name | dto-contract |
| description | Defines DTO structure, lifecycle, and transformation rules across the application |
| license | MIT |
| metadata | {"author":"project"} |
DTOs define structured, transport-safe data contracts used between layers of the application.
They exist to replace unstructured arrays when data shape matters, is reused, or must remain consistent across boundaries.
DTOs MUST:
DTOs MUST NOT:
DTOs are simple POPOs with fluent getters and setters.
Example:
class InvoiceDto
{
private int $invoiceId;
private int $companyId;
private float $amount;
public function getInvoiceId(): int
{
return $this->invoiceId;
}
public function setInvoiceId(int $invoiceId): self
{
$this->invoiceId = $invoiceId;
return $this;
}
public function getCompanyId(): int
{
return $this->companyId;
}
public function setCompanyId(int $companyId): self
{
$this->companyId = $companyId;
return $this;
}
public function getAmount(): float
{
return $this->amount;
}
public function setAmount(float $amount): self
{
$this->amount = $amount;
return $this;
}
}
DTOs MUST be created via Transformers.
$dto = InvoiceTransformer::fromModel($invoice);
or
$dto = InvoiceTransformer::fromArray($data);
DTOs MUST NOT be manually assembled inside services unless trivial and explicitly justified.
Transformers are the ONLY layer allowed to construct DTOs.
DTOs MUST NOT depend on Transformers.
Direction is strictly:
Model / Array → Transformer → DTO → Service
Use DTOs when:
DTOs MAY be skipped when:
DTOs are explicit data contracts, not business logic containers.
DTOs MAY include region markers to improve IDE navigation (e.g. PhpStorm folding).
These are purely cosmetic and MUST NOT affect runtime behavior or architecture decisions.
Example:
class InvoiceDto
{
#region Properties
private int $invoiceId;
private int $companyId;
private float $amount;
#endregion
#region Getters
public function getInvoiceId(): int { ... }
public function getCompanyId(): int { ... }
public function getAmount(): float { ... }
#endregion
#region Setters
public function setInvoiceId(int $invoiceId): self { ... }
public function setCompanyId(int $companyId): self { ... }
public function setAmount(float $amount): self { ... }
#endregion
}
They exist to stabilize data shape across the system, not to introduce unnecessary abstraction.