Download the PHP package hank21014/synth without Composer

On this page you can find all versions of the php package hank21014/synth. 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 synth

tests

💧 PHP Synth: Seamless Data Hydration

Synth is a lightweight PHP utility designed to bridge the gap between complex objects and serializable arrays. By using custom "Synth," you can dehydrate objects into structured arrays and hydrate them back into their original state with type safety and zero fuss.

🌟 Why Synth?

🛠️ Installation

Install the package via Composer:

🚀 Quick Start

1. Define your Entity

A plain PHP class. No traits or inheritance required.

2. Create a Synth

Implement the Synth interface to define how your object should be transformed.

3. Usage

Register your Synth and start transforming data.

💡 Key Concepts

Dehydration

Taking a "living" object and drying it out into a portable array format (perfect for JSON or Database storage).

Hydration

Taking that array data and "watering" it back into a PHP object.

The Metadata Wrapper

Synth automatically wraps your payload with a [SYNTH] flag and a type key. This allows the SynthManager to automatically know which class to instantiate during hydration.

[!TIP] Balance Uniqueness vs. Length

When customizing the identity key, choose a value that is unique enough to avoid data collisions but short enough to keep your dehydrated payloads efficient.

Primitive Handling

Synth handles non-object types via a built-in PrimitiveSynth. This ensures that your basic data structures remain intact while objects are being transformed.

Type Strategy Detail
Scalar/Null Pass-through Values like int, float, string, bool or null are returned without modification.
Standard Array Recursive Every element inside the array is checked and processed by the SynthManager.
Synthesized Array Delegated Arrays containing the [SYNTH] flag are passed to their respective specialized Synths.

⚙️ Advanced Configuration

Customizing the Identity Key

Configuring Global Synths

Synth comes with built-in support for common PHP types: Synth Class Target Type
\Hank21014\Synth\Synths\DateTimeSynth \DateTime
\Hank21014\Synth\Synths\DateTimeImmutableSynth \DateTimeImmutable

To disable all global synths:

To customize global synths:

[!IMPORTANT] Global configuration must be performed before the SynthManager is initialized. Calling these methods after instantiation will have no effect on existing manager instances.


All versions of synth 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 hank21014/synth contains the following files

Loading the files please wait ...