Download the PHP package andrewsauder/json-deserialize without Composer

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

Json Deserialize Utility

JSON Deserialize is an abstract class that enables JSON deserialization into a specific class. Simply extend the jsonDeserialize class and then call the static jsonDeserialize method. Requires all properties to be typed. Array type will be determined by a PHPDoc definition.

Requires >=PHP 8

Installation

composer require andrewsauder/json-deserialize

Usage

Extend your class from \andrewsauder\jsonDeserialize\jsonDeserialize class then call {yourClass}::jsonDeserialize( {stringified json} ); to deserialize the JSON automatically into your class.

Attributes

excludeJsonDeserialize

Tag properties on your class with the #[excludeJsonDeserialize] attribute to prevent the value of the field from being deserialized into the class generated by jsonDeserialize()

excludeJsonSerialize

Tag properties on your class with the #[excludeJsonSerialize] attribute to prevent that field from being serialized into the output of json_encode();

Hooks

The hooks provided allow you ti extend the default functionality of jsonDeserialize. Add hook methods to your class that extends \andrewsauder\jsonDeserialize\jsonDeserialize. The hook will be called automatically during the deserialization and serialization lifecycle.

Before Json Deserialize

Static method called on a class immediately before deserialization into the class occurs.

After Json Deserialize

Called on a newly created instance after deserialization is complete.

Before Json Serialize

Called on an instance immediately before serialization to JSON.

After Json Serialize

Called on an instance after serialization to a plain array. The standard export data is provided to the hook and the hook must return an array which will be immediately encoded to JSON.

Code Example

myModel.php

myController.php

Output:

Debug Logging

To enable debug logging, add these lines prior to deserializing. All objects deserialized after will include debug logging to a new log file in the provided path. The logging is expensive but it is useful for determining missing properties on classes or json data.

Fine Tune Logging

By default, when logging is enabled, all debugging messages are enabled.


All versions of json-deserialize with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
monolog/monolog Version ^3.4.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 andrewsauder/json-deserialize contains the following files

Loading the files please wait ....