Download the PHP package mash/mysql-json-serializer without Composer

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

Build Status License: MIT Lasr: Release

mysql-json-serializer

This solution will help you to get serialized data from mysql

About package

This package allows to get json objects already mapped by created mapping scheme. You will not lost time after query because you will get json from database.

Install

Examples

You will be able to make easy difficult query and get already mapped data. For example I will show you some SQL queries which I created by this package.

Example 1 (SELECT JSON WITH OneToMany relation field)

result

Example 2 (SELECT JSON WITH ManyToOne relation field)

result

Example 3 (SELECT JSON WITH ManyToMany relation field)

result

Example 4 (OneToOne relation)

result

Symfony 4 (flex) Integration

Configure

Add this to services.yaml:

Setup your Entities

Below you will find information how to configure your entities for auto serialization

Look to example on top, it's really easy to configure the serialization, looks like using JMSSerializer, or Symfony serializer, when I was writing this feature, I use my experience in Symfony, and take only good things.

If you want to expose some field add @MysqlJSON\Expose(groups={"page_full"}) and add @Rest\View(serializerGroups={"Default", "page_full"}) on controller method

note: If you use @MysqlJSON\Expose without setting groups, field will have Default group

Lets see, how to return result from controller

Method $builder->jsonPagination($page, $limit); allows to paginate data into mysql, and return json with all relations, pages, total count and other pagination fields

Example:

Also you can get the single serialized object by $builder->jsonObject($page->getId()); method, it will return serialized object

Example:

You can use your CustomTypes for implementation you custom serialization logic, for example, by default MySQL serialize blob as base64 decoded value in JSON, but if we add @MysqlJSON\Expose(groups={"Default", "page_full"}, type="Mash\MysqlJsonSerializer\Wrapper\Type\Blob") annotation, FieldWrapper will use this type in serialization and return text.

Example of CustomType:

It's easy to write your custom type, just implement interface CustomTypeInterface and use MySQL functions into.

Updates

v. 2.0.5

Now you can create virtual properties, it allows to avoid database denormalization and keep relation model.

example of Entity configuration, just add map to class doc comment.

result:


All versions of mysql-json-serializer with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
friendsofsymfony/rest-bundle Version ^2.3
sensio/framework-extra-bundle Version ^5.1
symfony/http-kernel Version ^4.1
symfony/event-dispatcher Version ~3.4|~4.0
symfony/doctrine-bridge Version ~3.0|~4.0
doctrine/orm Version ^2.3
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 mash/mysql-json-serializer contains the following files

Loading the files please wait ....