Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

jooservices/dto

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

101 Commits
101 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

JOOservices DTO Library

codecov CI OpenSSF Scorecard PHP Version License: MIT Packagist Version

The JOOservices DTO Library is a PHP 8.5+ library for constructor-based DTO hydration, mutable data objects, opt-in validation, serialization control, and DTO collection wrappers.

Package name: jooservices/dto

Install

composer require jooservices/dto

Quick example

use DateTimeImmutable;
use JOOservices\Dto\Attributes\MapFrom;
use JOOservices\Dto\Core\Dto;

final class UserDto extends Dto
{
    public function __construct(
        public readonly string $id,
        #[MapFrom('email_address')]
        public readonly string $email,
        public readonly DateTimeImmutable $createdAt,
    ) {}
}

$user = UserDto::from([
    'id' => 'u_123',
    'email_address' => 'john@example.com',
    'createdAt' => '2026-01-15T10:30:00+00:00',
]);

$payload = $user->toArray();

What is supported today

  • Dto and Data
  • hydration from arrays, JSON strings, and simple public-property objects
  • scalar, enum, and DateTimeInterface casting
  • nested single DTO hydration
  • class-level polymorphic DTO hydration with #[DiscriminatorMap]
  • typed array hydration from common PHPDoc annotations such as Type[], array<Type>, and list<Type>
  • fallback property defaults with #[DefaultFrom]
  • opt-in validation with attributes
  • serialization filtering and wrapping
  • lazy derived serialization through ComputesLazyProperties
  • DataCollection and PaginatedCollection

Important current limitations

  • several declared attributes are still only partially wired into runtime behavior; Computed, Deprecated, OptionalProperty, and Context::$globalPipeline remain incomplete, and Pipeline support is limited to current property-level execution paths rather than a broader end-to-end pipeline system
  • StrictType now affects input shape enforcement and implicit casting rules, but related pipeline and schema behavior remains narrower than the declared attribute surface

Documentation

Start with:

AI Support

This repository includes an AI skill pack for agents working in Cursor, Claude Code, VS Code, JetBrains, and Antigravity.

Start with:

The canonical skill source lives in .github/skills/, with adapter layers for each supported AI environment.

Development

composer lint
composer lint:all
composer test
composer test:coverage
composer check
composer ci

Contributor workflow details live in:

Community

GitHub Actions and Services

Current GitHub Actions coverage:

  • CI: security checks, linting, tests, 95% minimum statement coverage, coverage upload, and optional SonarQube Cloud analysis when SONAR_TOKEN is configured
  • Release: validate tags, create GitHub releases, trigger Packagist update
  • PR Labeler: apply labels to pull requests
  • Semantic PR Title: enforce pull request title format
  • OpenSSF Scorecard: publish scorecard results as SARIF
  • Secret Scanning: workflow file exists, but the gitleaks job is currently disabled

External services currently used by workflows:

Important notes:

  • No workflow currently defines Docker-style services: containers such as MySQL, Redis, or PostgreSQL.
  • SonarQube Cloud analysis is present in ci.yml, but it only runs after tests pass and only when SONAR_TOKEN is available.

License

This project is licensed under the MIT License.

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.