DTO Interfaces naming convention in PHP

It might be that my question would sound a bit stupid but I would like to find the best way for naming my DTO interfaces. In my PHP application I have following DTO types: Simple (which contains a list of properties), for example CredentialsDTO, PhoneDTO, AgreementDTO. Array-like (which contains an array of single-type DTOs, any of these three), for example AgreementsDTO which contain some AgreementDTO. Complex or Nested (which contains a few other DTOs, either simple, array-like or complex/nested), for example AccountDTO (which contains CredentialsDTO, PhoneDTO, AgreementsDTO). I would like to create an interfaces for these three types but I don't really know how to name them. OK, the first one might be just a DTOInterface, for me it sounds clear, array-like is more complicated, ChatGPT offered me DTOCollectionInterface or DTOListInterface but from my perspective collection MUST have data manipulation methods and list... I don't really understand how them differ from arrays. Talking about complex/nested, I think anything is fine so I just wanna know which one is standard-to-use. Thanks in advance!

Feb 2, 2025 - 11:43
 0
DTO Interfaces naming convention in PHP

It might be that my question would sound a bit stupid but I would like to find the best way for naming my DTO interfaces. In my PHP application I have following DTO types:

  • Simple (which contains a list of properties), for example CredentialsDTO, PhoneDTO, AgreementDTO.
  • Array-like (which contains an array of single-type DTOs, any of these three), for example AgreementsDTO which contain some AgreementDTO.
  • Complex or Nested (which contains a few other DTOs, either simple, array-like or complex/nested), for example AccountDTO (which contains CredentialsDTO, PhoneDTO, AgreementsDTO).

I would like to create an interfaces for these three types but I don't really know how to name them.

OK, the first one might be just a DTOInterface, for me it sounds clear, array-like is more complicated, ChatGPT offered me DTOCollectionInterface or DTOListInterface but from my perspective collection MUST have data manipulation methods and list... I don't really understand how them differ from arrays.

Talking about complex/nested, I think anything is fine so I just wanna know which one is standard-to-use.

Thanks in advance!