Download the PHP package tarikweiss/tjson without Composer

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

tjson GitHub Packagist Version

Map json strings into objects and vice versa.

Usage

This library contains an encoder and decoder for mapping objects into json strings and vice versa. It will map all properties (including private and protected), as long they are not marked to be not converted.

Sample object class

The properties can be configured with doctrine annotations or the new PHP 8 attributes. A full documentation of the annotations/attributes is following.

Basic Usage

JSON

This json is assumed as value for $jsonString for the following samples: `

Decoder

Decoding is done as follows:

Encoder

Encoding is done as follows:

Attributes/Annotations

You can use the attributes/annotations to control the behaviour for encoding or decoding. Attributes are always over the doctrine annotations in the hierarchy. That means, if you define something as annotation and as attribute, then the attribute will win.

MappedPropertyClass

This annotation is used for setting a specific class on decoding. It needs to match a type, if given, otherwise an exception is thrown.

MappedPropertyName

This is used to change the name of the property for encoding/decoding. For example, you can use foo_bar as the json property name but use fooBar as your property name in your object/class. But it could also contain a completely different name. If the name defined is occurring multiple times then an exception is thrown. For example, you have to properties, called foo and bar in your class, and you annotate foo with this annotation and the value bar, then you have defined the name bar multiple times, which leads to an exception.

Omit

This annotation explicitly disables the mapping of a property in both directions, meaning if the property exists in the json it would be ignored on decoding and if it exists on encoding it would not be in the json.
CAUTION This annotation overrides the duplication check for this annotation, as it is not considered for mapping.

Required

This property is used to define something as required. This is especially used for untyped properties, meaning a typed property will always be required by default.
CAUTION You may use this annotation to disable the required state of a property, also if it is typed, but that would mean, that properties stay uninitialized and may cause illegal access (for example using getters).


All versions of tjson with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-json Version *
doctrine/annotations Version ^1.13
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 tarikweiss/tjson contains the following files

Loading the files please wait ....