Download the PHP package callismart/dto without Composer

On this page you can find all versions of the php package callismart/dto. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dto

Callismart DTO

A flexible, extensible foundation for Data Transfer Objects (DTOs) in PHP 8.1+. Build type-safe, immutable data containers with zero dependencies.

Why Callismart DTO?

DTOs are fundamental building blocks for clean architecture, but creating them usually means writing repetitive boilerplate. Callismart DTO eliminates that by providing a powerful, extensible base class that handles:

Perfect for APIs, configuration objects, domain models, and any data transfer scenario.

Installation

Install via Composer:

Requirements: PHP 8.1 or higher

Quick Start

Basic Usage

Creating Type-Safe Subclasses

Restrict allowed keys and apply type casting:

Core Features

Dynamic Properties

Access properties using any of three syntaxes:

Type Casting & Validation

Override cast() to enforce types and validate values:

Key Whitelisting

Restrict which keys are allowed:

Sensitive Value Masking

Protect sensitive data in debugging and serialization:

Fluent API

Chain methods for readable code:

Advanced Operations

Serialization

DTOs work with standard PHP serialization interfaces:

Debugging

API Reference

Reading

Writing

Selection

Serialization

Extension Points

Override these methods in subclasses to customize behavior:

allowed_keys()

Restrict which properties can be set:

Return empty array (default) to allow any key.

sensitive_keys()

Mark values that should be masked in output:

Sensitive values are masked as *** in:

cast()

Transform or validate values before storage:

Can throw InvalidArgumentException for invalid values.

Examples

API Request/Response

Configuration Object

Domain Entity

Nested DTOs

Testing

Run the test suite with:

Or with PHPUnit directly:

Best Practices

  1. Create Typed Subclasses — Always subclass DTO for domain objects, not raw instances
  2. Define allowed_keys() — Restrict to prevent typos and unexpected properties
  3. Implement cast() — Enforce types, trim strings, validate values
  4. Mark sensitive_keys() — Protect passwords, tokens, API keys, etc.
  5. Use Fluent API — Chain methods for readable initialization
  6. Immutability — Once created, avoid mutating DTOs (clone if needed)
  7. Safe Logging — Use dump() or to_array() for safe debug output

Performance

The DTO class is designed for performance:

Security

Sensitive value protection:

Requirements

License

MIT License. See LICENSE file for details.

Contributing

Contributions are welcome! Please ensure:

Support

Related Packages

Changelog

v1.0.0

Author

Callistus Nwachukwu - [email protected]


All versions of dto with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package callismart/dto contains the following files

Loading the files please wait ...