Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Weui Bundle Laravel Package

tourze/weui-bundle

A Symfony bundle that integrates WeUI, WeChat's official mobile UI library, giving you Twig templates, form themes, and prebuilt assets so you can quickly build clean, native-looking WeChat-style pages and web apps without hand-writing markup or CSS.

View on GitHub
Deep Wiki
Context7

Getting Started

tourze/weui-bundle is a Symfony bundle that vendors Tencent's WeUI stylesheet/JS (the official WeChat look-and-feel library for H5 pages opened inside the WeChat webview) and exposes it to a PHP app. The 1.0.2 release is a patch on the 1.0.x line — the release notes are a bare Full Changelog compare link with no enumerated changes, so treat it as a maintenance/bugfix bump with no expected API surface change.

Minimal steps for a Laravel developer:

  1. composer require tourze/weui-bundle:^1.0 — install it purely as an asset source, not as a runtime dependency.
  2. Immediately open vendor/tourze/weui-bundle/ and read composer.json plus the Resources/ tree. That is where the compiled weui.min.css, weui.min.js, and the weui-wxss-style dist files live. Confirm the exact paths before writing any code — the bundle has been renamed/reorganised across the tourze family, so do not assume Resources/public.
  3. Copy (or symlink) the dist folder into public/vendor/weui/. Laravel will not auto-publish Symfony bundle assets; there is no php artisan vendor:publish tag for this package.
  4. First use case: a WeChat-only H5 page. Add the two tags to a dedicated Blade layout and build a form with weui-cells / weui-cell / weui-btn classes.
{{-- resources/views/layouts/wechat.blade.php --}}
<link rel="stylesheet" href="{{ asset('vendor/weui/weui.min.css') }}">
<script src="{{ asset('vendor/weui/weui.min.js') }}"></script>

If you actually are on Symfony, the bundle registers itself via WeuiBundle::class in config/bundles.php and you get Twig/AssetMapper wiring for free — everything below still applies, minus the manual copy step.

Implementation Patterns

Treat it as a versioned asset vendor, not a framework integration. The realistic day-to-day pattern in Laravel is: pin the Composer version, expose the CSS/JS through public/, and never reference the bundle namespace in application code.

  • Asset pipeline: prefer copying into resources/ and letting Vite/Mix hash and bundle, so cache-busting and CSP are handled. If you must serve straight from vendor/, add a composer post-install-cmd script or a small Artisan command to re-copy on composer update, otherwise upgrades silently no-op.
  • Layout-per-channel: keep a layouts/wechat.blade.php separate from your normal layout. WeUI resets html { font-size: 20px } and re-bases everything on rem/rpx; it will visibly wreck a desktop Bootstrap/Tailwind page if loaded globally.
  • Component partials: wrap the recurring blocks (weui-cell, weui-btn, weui-cells__title, weui-tabbar, weui-dialog) in Blade components — <x-weui.cell label="..." />. WeUI is class-driven with almost no JS contract, so this is cheap and pays off immediately.
  • Dialogs/toasts: weui.min.js is a thin helper layer, not a component framework. The dialog is markup + a class toggle; drive it from Alpine or a tiny inline script rather than expecting a JS API. Many teams skip weui.min.js entirely and hand-roll the class toggles.
  • WeChat JS-SDK coexistence: WeUI is presentation only. wx.config, wx.chooseImage, sharing, etc. come from jweixin-1.6.0.js loaded separately. Keep them as two distinct concerns; don't look for WeChat bridge helpers in this package.
  • Blade + @vite: @vite(['resources/css/weui.css', 'resources/js/weui.js']) after copying is the cleanest modern setup; it gives you a single manifest and removes the public/vendor special case.

Gotchas and Tips

  • Symfony bundle autodiscovery does not apply to Laravel. There is no service provider for Laravel to load, no config file to publish, no facade. If you install it expecting Weui:: anything, you'll get nothing. Verify with composer show tourze/weui-bundle and read the type field — symfony-bundle means "assets + Twig extension only" from your perspective.
  • Verify the bundled WeUI version. The upstream WeUI is at 2.6.x; older bundles ship 2.4/2.5 with subtly different markup (notably dialog and weui-form). Check package.json/README inside the vendor dir. If it is stale, npm i weui is often the better call and this package adds little.
  • Missing images and fonts. The dist CSS references ../images/* and icon fonts with relative paths. A copy that flattens the directory structure produces silent 404s and broken checkmarks/arrows — copy the whole sibling tree, images/ and fonts/ included, and confirm with DevTools' Network tab filtered to 404.
  • Rem base font size. WeUI sets a root font-size; any Tailwind text-sm or Bootstrap rem-based spacing inside a WeUI page will render at the wrong scale. Scope the WeUI stylesheet to a wrapper (.weui-scope) or accept that the WeChat layout is fully quarantined.
  • No CSP nonces, no SRI. Assets are plain files; if you have a strict Content-Security-Policy you must add 'self' for the asset origin yourself, and there are no integrity hashes to pin.
  • Upgrade risk on 1.0.2 is low but unevidenced. The changelog is a GitHub compare link only. Diff vendor/tourze/weui-bundle against your committed copy after composer update (git diff --no-index or just diff -r) and commit the asset changes alongside the lockfile bump — that diff is your release note.
  • Extension points: effectively none in Laravel. In Symfony, the Twig namespace is the only hook worth knowing. If you need to customise WeUI variables, compile your own SCSS from upstream rather than patching vendored files — patched vendor assets are lost on every composer update.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings