Download the PHP package zero-to-prod/data-model without Composer

On this page you can find all versions of the php package zero-to-prod/data-model. 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 data-model

Zerotoprod\DataModel

Repo Latest Version on Packagist test Downloads

The Zerotoprod\DataModel trait simplifies data handling by allowing developers to create class instances from arrays or JSON, dynamically assigning and casting property values based on type annotations.

Whether you’re managing simple strings or complex object types, this package ensures your data models are both flexible and reliable.

Perfect for developers looking to simplify their Data Transfer Objects (DTOs);

Installation

You can install the package via Composer:

Usage

Import the Zerotoprod\DataModel\DataModel trait in your class. Use the from() static method to map array keys to class properties.

It is recommended to extend your own DataModel trait with the Zerotoprod\DataModel\DataModel trait.

Basic Example

Automatically Typecast Properties With Doc Comments

Use PHPDoc @var annotations to link and cast properties to their classes, ensuring accurate mapping and conversion, especially with nested objects.

Inlining the fully qualified namespace is faster as a lookup does not have to be performed.

This directs the from() method to instantiate the Address class for $Address when mapping data.

Automatically casted types include:

Notes

Suggested Traits

Zerotoprod\DataModel\FromJson

This will decode a valid json string and return the data model.

Usage

To use the Zerotoprod\DataModel\FromJson trait in your class.

Zerotoprod\Transformable

The Transformable trait provides methods to convert an object’s properties into an array or a JSON string. This is particularly useful for serializing your data models.

Usage

To use the Zerotoprod\Transformable\Transformable trait in your class.


All versions of data-model with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
ext-json Version *
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 zero-to-prod/data-model contains the following files

Loading the files please wait ....