drewkimberly/php_dtos

A simple PHP Data Transfer Object (DTO) library.

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/drewkimberly/php_dtos

v1.2.0 2020-05-03 22:39 UTC

This package is auto-updated.

Last update: 2025-12-04 11:57:45 UTC


README

A simple PHP DTO library.

PHP version Build Status Coverage Status

Installation:

composer require drewkimberly/php_dtos

Usage:

This library aims to make it easy to create Data Transfer Objects (DTOs). DTOs are simple encapsulations of data, independent of application or domain-specific logic. They are serializable objects, making them a clean way to represent data in the transfer layer of an application (i.e. REST API payloads).

The following table highlights the main classes introduced by this library:

Class Responsibility
\php_dtos\Dto\DtoBase Subclass of all DTOs implemented in an application.
\php_dtos\Dto\DtoCollection Represents a DTO collection in an application. In rare cases this class can be subclassed, but the typical usecase should look something like: new DtoCollection(MyDto::class);, where the collection is instantiated with a reference to the underlying (or collected) DTO instance.
\php_dtos\Json\JsonReader Helper class for safely parsing incoming JSON.

For more information on Data Transfer Objects, see:

Development

Setup

  1. Fork this repository
  2. Clone your forked repository
  3. From the root of your cloned repository run: composer install

Testing

TravisCI is used for CI/CD. The following validations are performed against every Pull Request:

  1. PHPLint
  2. PHP Codesniffer (PSR2 Sniff)
  3. PHPUnit

Deployment

When a tag is cut, TravisCI will deploy the package to packagist.

Contributing

  1. Open an Issue on GitHub.
  2. Open a Pull Request.
    • Make sure the TravisCI build is passing for your PR.
    • Request a Code Review on your PR.