sagor110090/livewire-modal
Composer 安装命令:
composer require sagor110090/livewire-modal
包简介
This Laravel Livewire package simplifies the implementation of dynamic, responsive modals in your web applications. With a focus on seamless integration and flexibility, this package allows developers to easily create and manage modals without the need for JavaScript or additional front-end dependen
README 文档
README
A simple and flexible Laravel Livewire modal package that works seamlessly with any design framework like Bootstrap, Tailwind CSS, or even custom styles. This package allows you to quickly integrate modals into your Livewire projects without being tied to specific CSS libraries.
Features
- Framework-Agnostic: Use with Bootstrap, Tailwind CSS, or custom designs.
- Dynamic Modals: Open and close modals using Livewire events.
- Customizable: Easily style your modals with your preferred CSS.
Installation
You can install the package via Composer:
composer require sagor110090/livewire-modal
Setup
Add the following to your app.blade.php layout to enable modals throughout your application:
<livewire:modals/>
Include the required JavaScript and CSS files in your resources/js/app.js:
import '../../vendor/sagor110090/livewire-modal/resources/js/loader.js'; import '../../vendor/sagor110090/livewire-modal/resources/css/loader.css';
Usage
Opening a Modal
To open a modal, you can dispatch a Livewire event from any button or action:
<button wire:click="$dispatch('openModal', { component: 'edit-user', data: { id: {{ $user->id }} } })"> Open Modal </button>
- component: The name of the Livewire component you want to load.
- data: The data you want to pass to the component (e.g., user ID).
Closing a Modal
To close a modal, simply dispatch the close event:
<button type="button" wire:click="$dispatch('closeModal')"> Cancel </button>
Sample Livewire Component
Here’s an example of a Livewire component you might use with this package:
<?php namespace App\Livewire; use App\Models\User; use Livewire\Component; class EditUser extends Component { public $user; public function mount($id) { $this->user = User::find($id); } public function render() { return view('livewire.edit-user'); } }
Blade View Example
The modal content is fully customizable within your Livewire component's view file:
<!-- resources/views/livewire/edit-user.blade.php --> <div> <h2>Edit User: {{ $user->name }}</h2> <!-- Your form or content here --> </div>
You can use any CSS framework or custom styles in this view file. The package does not impose any specific design restrictions.
Example Styles
You can design the modal with any framework. Below is an example using Tailwind CSS:
<div class="fixed inset-0 flex items-center justify-center bg-gray-900 bg-opacity-50"> <div class="bg-white rounded-lg shadow-lg p-6"> <!-- Modal Content --> </div> </div>
Alternatively, use Bootstrap or any other CSS framework.
Why Use This Package?
- Flexibility: Unlike many modal packages, this one doesn't enforce a specific CSS framework, giving you full control over your design.
- Ease of Use: Simple to implement with just a few Livewire events.
- Dynamic Data Handling: Pass data seamlessly to your modals, making them fully dynamic.
SEO Considerations
This Laravel Livewire modal package is designed to be lightweight and versatile, providing developers with an easy way to implement customizable modals across different design frameworks. Whether you're using Bootstrap, Tailwind CSS, or custom styles, this package adapts to your needs without locking you into specific CSS libraries. Enhance your Laravel projects with a modular and framework-agnostic approach to modals.
Support
For any issues or feature requests, feel free to open an issue.
License
This package is open-source software licensed under the MIT license.
sagor110090/livewire-modal 适用场景与选型建议
sagor110090/livewire-modal 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 162 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 08 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「modal」 「livewire」 「livewire-modal」 「sagor110090」 「modal component」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sagor110090/livewire-modal 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sagor110090/livewire-modal 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sagor110090/livewire-modal 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Fork from ghosh/Micromodal. Tiny, dependency-free javascript library for creating accessible modal dialogs.
Livewire starter kit for Lunar e-commerce.
Make Filament modals draggable.
A Filament form component that displays repeater items in a table with modal-based editing.
A Laravel Nova field. To create a modal for creating or viewing related HasMany records without leaving the index page
统计信息
- 总下载量: 162
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 32
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-18