All Projects → liyu001989 → dingo-serializer-switch

liyu001989 / dingo-serializer-switch

Licence: MIT license
A middleware to switch fractal serializers in dingo

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to dingo-serializer-switch

laravel5-jsonapi-dingo
Laravel5 JSONAPI and Dingo together to build APIs fast
Stars: ✭ 29 (-40.82%)
Mutual labels:  serializer, transformer, dingo
laravel5-hal-json
Laravel 5 HAL+JSON API Transformer Package
Stars: ✭ 15 (-69.39%)
Mutual labels:  serializer, transformer
php-json-api
JSON API transformer outputting valid (PSR-7) API Responses.
Stars: ✭ 68 (+38.78%)
Mutual labels:  serializer, transformer
Symfony Jsonapi
JSON API Transformer Bundle for Symfony 2 and Symfony 3
Stars: ✭ 114 (+132.65%)
Mutual labels:  serializer, transformer
sparql-transformer
A more handy way to use SPARQL data in your web app
Stars: ✭ 38 (-22.45%)
Mutual labels:  transformer
php-serializer
Serialize PHP variables, including objects, in any format. Support to unserialize it too.
Stars: ✭ 47 (-4.08%)
Mutual labels:  transformer
fastT5
⚡ boost inference speed of T5 models by 5x & reduce the model size by 3x.
Stars: ✭ 421 (+759.18%)
Mutual labels:  transformer
R-MeN
Transformer-based Memory Networks for Knowledge Graph Embeddings (ACL 2020) (Pytorch and Tensorflow)
Stars: ✭ 74 (+51.02%)
Mutual labels:  transformer
VideoTransformer-pytorch
PyTorch implementation of a collections of scalable Video Transformer Benchmarks.
Stars: ✭ 159 (+224.49%)
Mutual labels:  transformer
gonrails
Rails like mvc backend application with golang .
Stars: ✭ 37 (-24.49%)
Mutual labels:  serializer
TransBTS
This repo provides the official code for : 1) TransBTS: Multimodal Brain Tumor Segmentation Using Transformer (https://arxiv.org/abs/2103.04430) , accepted by MICCAI2021. 2) TransBTSV2: Towards Better and More Efficient Volumetric Segmentation of Medical Images(https://arxiv.org/abs/2201.12785).
Stars: ✭ 254 (+418.37%)
Mutual labels:  transformer
project-code-py
Leetcode using AI
Stars: ✭ 100 (+104.08%)
Mutual labels:  transformer
TokenLabeling
Pytorch implementation of "All Tokens Matter: Token Labeling for Training Better Vision Transformers"
Stars: ✭ 385 (+685.71%)
Mutual labels:  transformer
ru-dalle
Generate images from texts. In Russian
Stars: ✭ 1,606 (+3177.55%)
Mutual labels:  transformer
Transformer Temporal Tagger
Code and data form the paper BERT Got a Date: Introducing Transformers to Temporal Tagging
Stars: ✭ 55 (+12.24%)
Mutual labels:  transformer
ViTs-vs-CNNs
[NeurIPS 2021]: Are Transformers More Robust Than CNNs? (Pytorch implementation & checkpoints)
Stars: ✭ 145 (+195.92%)
Mutual labels:  transformer
kaggle-champs
Code for the CHAMPS Predicting Molecular Properties Kaggle competition
Stars: ✭ 49 (+0%)
Mutual labels:  transformer
Variational-Transformer
Variational Transformers for Diverse Response Generation
Stars: ✭ 79 (+61.22%)
Mutual labels:  transformer
cape
Continuous Augmented Positional Embeddings (CAPE) implementation for PyTorch
Stars: ✭ 29 (-40.82%)
Mutual labels:  transformer
libai
LiBai(李白): A Toolbox for Large-Scale Distributed Parallel Training
Stars: ✭ 284 (+479.59%)
Mutual labels:  transformer

Dingo Serializer Switch

This is a middleware for dingo/api to switch serializer

If a resource's relationship is null, we can return $this->null() in a transformer. But default serializer return [], I think null is better. Also when pagination has no links, default is [], I wish to return null. So I write two serializer to fix this.

If you want to use default serializer just use default_array or default_data_array.

Installation

Laravel

  • composer require liyu/dingo-serializer-switch

Lumen

bootstrap/app.php

$app->routeMiddleware([
    // ...
    'serializer' => Liyu\Dingo\SerializerSwitch::class,
]);

Usage

$api->version('v1',
    ['middleware' => 'serializer:array'],
    function ($api) {
});

$api->version('v2',
    ['middleware' => 'serializer'],
    function ($api) {
});

$api->version('v3',
    ['middleware' => 'serializer:data_array'],
    function ($api) {
});

default key is data_array, so v2 v3 is same.

'default_array' => 'League\Fractal\Serializer\ArraySerializer',
'default_data_array' => 'League\Fractal\Serializer\DataArraySerializer',
'json_api' => 'League\Fractal\Serializer\JsonApiSerializer',

'array' => 'Liyu\Dingo\Serializers\ArraySerializer',
'data_array' => 'Liyu\Dingo\Serializers\DataArraySerializer',

License

MIT LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].