承接 aristonis/laravel-livewire-dataview 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

aristonis/laravel-livewire-dataview

最新稳定版本:0.1.0

Composer 安装命令:

composer require aristonis/laravel-livewire-dataview

包简介

this package manage livewire components to show set of item and handle quering of database

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Laravel Livewire Dataview is a developer-focused toolkit for building SOLID-friendly data listing experiences in Livewire 3. It standardises how you configure queries, pagination and row rendering while keeping your components expressive and testable.
see docs

Features

  • Opinionated abstract component (DataViewComponent) that centralises pagination, queries and rendering.
  • Strongly validated traits for query definitions, pagination configuration and per-item views.
  • Default Blade view that wires your per-item Livewire components and pagination links.
  • dataview:make artisan command to scaffold a DataView component plus optional item component and Blade view.
  • Config publishing for project-wide defaults (config/dataview.php) and reusable stubs for custom scaffolding.

Requirements

  • PHP 8.2+
  • Laravel 10.x or 11.x with Livewire 3.6+
  • Composer and Node tooling if you plan to style the bundled Blade view

Installation

composer require aristonis/laravel-livewire-dataview

Optionally publish the package assets:

php artisan vendor:publish --tag=dataview-views    # copues views component and customize it
php artisan vendor:publish --tag=dataview-config   # copies config/dataview.php
php artisan vendor:publish --tag=dataview-stubs    # copies stub templates

Quick start

  1. Scaffold a dataview plus item component:

    php artisan dataview:make Users/UserTable --with-item
  2. Edit the generated component so it extends Aristonis\LaravelLivewireDataview\DataViewComponent and configure the query, pagination and item view:

    <?php
    
    namespace App\Livewire\Users;
    
    use App\Models\User;
    use Aristonis\LaravelLivewireDataview\DataViewComponent;
    
    class UserTable extends DataViewComponent
    {
        protected function configure(): void
        {
            $this->setItemView('users.user-table-item');
            $this->setPerPage(20);
        }
    
        protected function query()
        {
            return User::query()->with('roles')->orderByDesc('created_at');
        }
    }
  3. The generated Blade view (resources/views/livewire/users/user-table-item.blade.php) receives each item through the item prop. You can customise the markup as you see fit.

  4. Render the dataview in any Blade template:

    <livewire:users.user-table />

The default package view (aristonis-dataview::livewire.dataview) loops through your collection and renders the configured item component with stable Livewire keys, then shows pagination links when the query returns a paginator.

Configuration

config/dataview.php controls the base behaviour:

  • pagination.per_page: global default for $this->getPerPage().
  • pagination.enable: you can toggle pagination at runtime with enablePagination() / disablePagination().
  • item.keyName: used when generating Livewire keys; override via $this->setKeyName('uuid').

Every component can override these defaults inside configure() to keep component logic predictable and SOLID.

Testing

composer test

The test suite relies on Orchestra Testbench. Please ensure new functionality is accompanied by unit or feature coverage.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details on our workflow and coding standards.

License

The MIT License (MIT). Please see LICENSE for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-20