Download the PHP package denisyfrolov/json-serializer without Composer

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

Simple PHP serializer for any objects to JSON.

Build Status Build Status Code Coverage Scrutinizer Code Quality Code Intelligence Status Latest Stable Version Total Downloads License

Installation

Use Composer to install the package:

Introduction

What is serialization?

In the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer, or transmitted across a network connection link) and reconstructed later in the same or another computer environment.

Features

This is a very simple class which allows you to serialize any child objects to JSON.

Serialization

Make your class to be inherited from the serializator class JsonSerializableObject:

Mark your class as serializable using the flag @JsonSerializable in an annotations area of the class:

If your class uses different classes as types for properties you want to serialize, mark all of these classes as serializable too. Otherwise the exception will be thrown: Class ClassName is not marked as serializable.

Make getters for all the properties you want to serialize. Also make the properties publicly accessible:

By default the serializer uses property names as field names in JSON's schema. If you want to customize the names in the schema, use @JsonPropertyName property_name keyword in an annotations area of the property:

To prevent any properties from serialization, mark the properties as Non Serializable using keyword @JsonPropertyNonSerializable in an annotations area of the property:

Call jsonSerialize() method to serialize your object to JSON format.

Output

Example

You can find this example with all the classes in example folder of the project.

Code

Output

Quality

To run the PHPUnit tests at the command line, go to the project's root directory and issue phpunit.

This library attempts to comply with PSR-4.

If you notice compliance oversights, please send a patch via pull request.

Contribute

Contributions to the package are always welcome!

Author

License

The code base is licensed under the MIT license.


All versions of json-serializer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.19
phpunit/phpunit Version ^6.5
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 denisyfrolov/json-serializer contains the following files

Loading the files please wait ....