定制 olssonm/livewire-synthesizer 二次开发

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

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

olssonm/livewire-synthesizer

最新稳定版本:v0.1

Composer 安装命令:

composer require olssonm/livewire-synthesizer

包简介

README 文档

README

Warning

In development, in no way near ready to use in production.

Simple classes when using simple objects via Livewire Synthesizers – saves some time instead of having to write custom synthesizers from scratch.

This package tries to hydrate and dehydrate all properties on the resource.

Note

Livewire already ships with synthesizers for simple objects such as collections and arrays, this package is when you need to use custom objects.

Resource

Represents your custom class/object. All you have to do is extend Olssonm\LivewireSynthesizer\Resources\GenericResource.

<?php

namespace App\Resources;

use Olssonm\LivewireSynthesizer\Resources\GenericResource;

class Post extends GenericResource
{
    //
}

Synthesizers

Your synthesizer, extend Olssonm\LivewireSynthesizer\Synthesizers\GenericSynthesizer, set a key and specify your class and your almost set.

Please note that your key has to be unique.

<?php

namespace App\Synthesizers;

use App\Resources\Post;
use Olssonm\LivewireSynthesizer\Synthesizers\GenericSynthesizer;

class Post extends GenericSynthesizer
{
    public static $key = 'post';

    public static $class = Post::class;
}

Registering your synthesizer

To enable Livewire to find and register the synthesizer you can register it in your AppServiceProvider;

use App\Support\Synthesizers\Post;
use Livewire\Livewire;

/**
 * Register any application services.
 */
public function register(): void
{
    Livewire::propertySynthesizer(Post::class);
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-20