rakoitde/cialpineui 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rakoitde/cialpineui

Composer 安装命令:

composer require rakoitde/cialpineui

包简介

CodeIgniter 4 Cell Component based on AlpineJS

README 文档

README

CiAlpineUI is a library for CodeIgniter 4 that provides an elegant way to build UI components (Cells) powered by Alpine.js. It is designed to seamlessly integrate dynamic front-end behavior within your CodeIgniter 4 applications.

Features

  • Component-based architecture for CodeIgniter 4.
  • Fully integrated with Alpine.js for lightweight interactivity.

Installation

composer require rakoitde/cialpineui

Or if you are developing locally:

git clone https://github.com/rakoitde/cialpineui.git
cd cialpineui
composer install

Requirements

  • PHP 8.3+
  • CodeIgniter 4

Usage

  1. Create new Cell
php spark make:uicomponent New

Modify New Component:

<?php

namespace App\Cells;

use Rakoitde\CiAlpineUI\Cells\CiAlpineUiComponent;

class NewCell extends CiAlpineUiComponent
{
    public $count = 0;
    
    public function increment()
    {
        $this->count++;
    }

    public function decrement()
    {
        $this->count--;
    }
}
  1. Modify New View (app/Cells/new.php):
<div <?= $this->getXTags() ?>>
    <button x-on:click="$cell.increment">++</button>
    <span x-text="count"></span>
    <button x-on:click="$cell.decrement">--</button>
    <input type="text" x-model="count">
</div>
  1. Include AlpineJS, CiAlpineUiJs and the New component in your layout
<!doctype html>
<head>
    <title>CiAlpineUi</title>
    <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
</head>
<body>
    <?= view_cell('App\Cells\NewCell') ?>
    <?= $this->include('Rakoitde\CiAlpineUI\Views\CiAlpineUiJs') ?>
</body>
</html>
  1. Rendered component
<div x-data="{'count':0}" x-component="NewCell">
    <button x-on:click="$cell.increment">++</button>
    <span x-text="count">0</span>
    <button x-on:click="$cell.decrement">--</button>
    <input type="text" x-model="count">
</div>

Development

Scripts available:

composer analyze    # Static analysis (phpstan, psalm, rector)
composer test       # Run PHPUnit tests
composer cs         # Check coding style
composer cs-fix     # Fix coding style

License

This project is licensed under the MIT License.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check issues page if you want to contribute.

Roadmap

  • Publish initial stable version
  • Expand documentation and examples
  • Create a set of common UI components

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-27