Download the PHP package thiagocordeiro/laravel-serializer without Composer

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

Laravel-Translator

Laravel-serializer serializes json body from requests into Value Objects and Value Objects into json responses. It creates factories to given objects and uses thiagocordeiro/serializer to create encodes and decoders.

Installation

You just have to require the package

Setting up

This package register its provider automatically, See laravel package discover. However if for any reason the provider doesn't get registered, then you can register the provider manually in config/app.php file:

Just by adding the provider, you'll be able to configure and inject value objects into controllers, however, in orther to return these objects, it is necessary to change Kernel.php with a custom router configuration, so Laravel will be able to serialize configured objects as responses.

Open App\Http\Kernel and add a __constructor according to the snipped above:

Configure value objects

Once the provider is registered and Kernel uses SerializerRouter, you'll have to configure the objects you want to have serialization enabled.

Open or create the configuration file config/serializer.php and add all the objects that should be serialized according to the following snippet:

Usage

Say you have an App\Order object and you want it to be serialized:

First thing is to add into config/serialization.php (See previous section).

Then in the routing file, inject or return the App\Order file into the routing:

Advance configuration

You might have advanced encoder and decoders to your Value Objects whenever necessary. please refer to thiagocordeiro/serializer documentation in order to have these configuration.

Note

  1. Value objects should not have complex logic as well as no infrastructure coupling, in other words, they should be dummy objects with constructors, private properties and getters. thiagocordeiro/serializer does't rely on public properties.
  2. There is no need to add inherited objects into config/serialization.php, however they will get created at runtime which might have effect as soon as the application warms up, by adding inherited objects into the configuration file, they might get created during cache clear command.

Contributing

Feel free to open issues, suggest changes and submit PRs :)

Supporting

If you feel like supporting changes then you can send donations to the address below.

Bitcoin Address: bc1qfyudlcxqnvqzxxgpvsfmadwudg4znk2z3asj9h


All versions of laravel-serializer with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-json Version *
laravel/framework Version >=11.0.0
thiagocordeiro/serializer Version ^3.2
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 thiagocordeiro/laravel-serializer contains the following files

Loading the files please wait ....