Download the PHP package maplephp/dto without Composer

On this page you can find all versions of the php package maplephp/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?
maplephp/dto
Rate from 1 - 5
Rated 5.00 based on 1 reviews

Informations about the package dto

MaplePHP - Data Transfer Object (DTO)

The MaplePHP DTO library simplifies working with structured data in PHP by wrapping it into objects. This allows easy traversal and transformation through a chainable interface, ensuring consistent, safe data handling and reducing the risk of direct data manipulation.


Note: MaplePHP DTO also includes polyfill classes for Multibyte String and Iconv support.


Usage

The simplest way to work with the library is to start with the Traverse class, which provides powerful control over your data.

Accessing Nested Data

Each key in the array is accessible as an object property, and you can continue to drill down into nested arrays, maintaining consistency and safety.

Iterating Through Arrays


Built-in Data Handlers

MaplePHP DTO comes with powerful handlers for common data transformations. These handlers make it easy to manipulate strings, numbers, URIs, arrays, dates, and more.

String Handling Example

You can chain methods for string manipulation:

You can also apply transformations when iterating over an array:


More Examples

Here are more examples of using the DTO library’s built-in handlers for different types of data:

String Manipulation

Number Formatting

Date Formatting


Note: This guide is a work in progress, with more content to be added soon.


How It Works

The MaplePHP DTO library operates by wrapping data into objects that allow easy traversal and transformation using a chainable API. This structure allows for consistent and safe data handling, minimizing direct data manipulation risks.

Here’s how the key components of the library work:

1. Traverse Class

At the core of the library is the Traverse class. This class allows you to wrap an associative array (or any data structure) into an object, making each element of the array accessible as an object property.

2. Handlers for Data Types

MaplePHP DTO uses specific handlers (such as Str, Num, DateTime, Uri, etc.) to manage different data types. These handlers provide methods to transform and validate the data.

3. Immutability

When transformations are applied (e.g., strUcFirst() or numRound()), the library ensures immutability by returning a new Traverse instance with the modified data. This prevents accidental mutations of the original data.

4. Fetch Method for Arrays

The fetch() method simplifies working with arrays. Instead of manually looping through the array, you can use fetch() to iterate over the elements and apply transformations to each one.


All versions of dto with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
maplephp/swiftrender Version ^2.0
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 maplephp/dto contains the following files

Loading the files please wait ....