tourze/weui-bundle 问题修复 & 功能扩展

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

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

tourze/weui-bundle

Composer 安装命令:

composer require tourze/weui-bundle

包简介

A Symfony Bundle for WeUI frontend framework integration

README 文档

README

PHP Version Require License Build Status Coverage Status

English | 中文

A Symfony Bundle that provides simple integration with WeUI frontend framework. Main features include:

  • Quick rendering of success and error pages with WeUI styling
  • Support for custom titles and subtitles
  • Control over action button display (showOp parameter)
  • Company name configuration via environment variables
  • Automatic copyright year generation
  • Mobile-optimized responsive design

Installation

Install via Composer:

composer require tourze/weui-bundle

Quick Start

After installation, the bundle will be automatically registered. You can immediately start using the NoticeService in your controllers:

<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use WeuiBundle\Service\NoticeService;

class DemoController extends AbstractController
{
    #[Route('/success', name: 'app_success')]
    public function success(NoticeService $noticeService): Response
    {
        return $noticeService->weuiSuccess('Operation Successful', 'Data has been processed');
    }

    #[Route('/error', name: 'app_error')]
    public function error(NoticeService $noticeService): Response
    {
        return $noticeService->weuiError('Operation Failed', 'Please try again later');
    }
}

Basic Usage

<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use WeuiBundle\Service\NoticeService;

class DemoController extends AbstractController
{
    #[Route('/success', name: 'app_success')]
    public function success(NoticeService $noticeService): Response
    {
        return $noticeService->weuiSuccess('Operation Successful', 'Data has been processed');
    }

    #[Route('/error', name: 'app_error')]
    public function error(NoticeService $noticeService): Response
    {
        return $noticeService->weuiError('Operation Failed', 'Please try again later');
    }
}

API Reference

NoticeService

weuiSuccess(string $title, string $subTitle = '', bool $showOp = true): Response

Renders a success page with green checkmark icon.

Parameters:

  • $title (string): Main title text
  • $subTitle (string, optional): Subtitle text below the main title
  • $showOp (bool, optional): Whether to show the "Close Page" button (default: true)

Returns: Response object containing the rendered HTML

weuiError(string $title, string $subTitle = '', bool $showOp = true): Response

Renders an error page with warning icon.

Parameters:

  • $title (string): Main title text
  • $subTitle (string, optional): Subtitle text below the main title
  • $showOp (bool, optional): Whether to show the "Close Page" button (default: true)

Returns: Response object containing the rendered HTML

Environment Configuration

Set the company name in your .env file, which will be displayed at the bottom of the page:

COMPANY_NAME=Your Company Name

Advanced Usage

Hiding Operation Buttons

If you want to hide the "Close Page" button:

// Success page without close button
return $noticeService->weuiSuccess('Success', 'Task completed', false);

// Error page without close button
return $noticeService->weuiError('Error', 'Something went wrong', false);

Custom Templates

The bundle uses the following templates:

  • @Weui/success.html.twig - Success page template
  • @Weui/failed.html.twig - Error page template
  • @Weui/base.html.twig - Base template

You can override these templates in your application by creating them in your templates/bundles/WeuiBundle/ directory.

Testing

Run unit tests:

./vendor/bin/phpunit packages/weui-bundle/tests

License

This project is licensed under the MIT License - see the LICENSE file for details.

tourze/weui-bundle 适用场景与选型建议

tourze/weui-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.25k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tourze/weui-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tourze/weui-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 tourze/weui-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3.25k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 19
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

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

其他信息

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