定制 dropelikeit/laravel-jms-serializer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dropelikeit/laravel-jms-serializer

最新稳定版本:v6.0.1

Composer 安装命令:

composer require dropelikeit/laravel-jms-serializer

包简介

Integration JMS Serializer in Laravel / Lumen

README 文档

README

Gitworkflow Coverage Status Monthly Downloads Daily Downloads Total Downloads Latest Stable Version Total Downloads License composer.lock Mutation testing badge

JMS Serializer for Laravel

This package integrates the JMS serializer into Laravel.

JMS-Serializer: https://github.com/schmittjoh/serializer

You are also welcome to use the Issue Tracker to set bugs, improvements or upgrade requests.

Please use the new package https://github.com/Dropelikeit/laravel-responsefactory in the future. The new package contains some new and useful functions! This package will only be supported until the end of Laravel 11. Until then, you should use the new package.

Installation

composer require dropelikeit/laravel-jms-serializer

Support note

How to use

Laravel uses Package Auto-Discovery, so you do not need to add the service provider manually.

For example, to use the JMS serializer in a controller, add the ResponseFactory in the constructor.

    <?php 
    namespace App\Http\Controller;

    use Dropelikeit\LaravelJmsSerializer\Http\Responses\ResponseFactory;
    use Symfony\Component\HttpFoundation\JsonResponse;

    final class ExampleController extends Controller 
    {
        public function __construct(private ResponseFactory $responseFactory) {}

        public function myAction(): JsonResponse
        {
            $myDataObjectWithSerializerAnnotations = new Object('some data');
            return $this->responseFactory->create($myDataObjectWithSerializerAnnotations);
        }
    }

Publish the Serializer Config with the command

    php artisan vendor:publish

After that you will see a config file in your config folder named "laravel-jms-serializer.php".

Upgrade

If you are upgrading this package from a version earlier than v4.0, see this upgrade file.

Documentation

统计信息

  • 总下载量: 5.97k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-17