承接 ethanbarlo/mesh 相关项目开发

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

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

ethanbarlo/mesh

最新稳定版本:v0.2.0

Composer 安装命令:

composer require ethanbarlo/mesh

包简介

Render React (and other frameworks) as the frontend of your Livewire components.

README 文档

README

A React + Livewire 4 islands bridge. Render interactive framework components inside Livewire, with props flowing across the boundary.

What it does

Mesh lets you drop a React (or Vue/Svelte) component into a Livewire view and treat it as an island. Livewire owns the server state; Mesh hands props across the bridge and mounts the component.

Install

composer require ethanbarlo/mesh

See INSTALL.md for the full host-app setup (Vite alias, app.ts, Livewire start).

Quick example

1. The PHP component

<?php

namespace App\Mesh;

use EthanBarlo\Mesh\Component;

class Counter extends Component
{
    public function props(): array
    {
        return [
            'start' => 0,
        ];
    }
}

2. The React component

A component is a folder whose index.{tsx,jsx} default-exports it.

// resources/js/mesh/Counter/index.tsx
import { useState } from 'react'

export default function Counter({ start }: { start: number }) {
  const [count, setCount] = useState(start)
  return <button onClick={() => setCount(count + 1)}>{count}</button>
}

3. Wire up app.ts

There is no per-component registration and nothing to declare for components. Mesh auto-discovers every component under resources/js/mesh and code-splits each into its own async chunk, loaded on first render. You only register your renderers:

// resources/js/app.ts
import { Livewire, Alpine } from '../../vendor/livewire/livewire/dist/livewire.esm'
import { initMesh } from '@mesh'
import reactRenderer from '@mesh/react'

initMesh(Livewire, {
  renderers: [reactRenderer],
  debug: true,
})

Livewire.start()

4. Render in Blade

<mesh:counter />

Documentation

Requirements

  • PHP 8.2+, Laravel 11+
  • Livewire 4
  • Node with Vite (host app)

License

MIT

Why an alias instead of npm?

The frontend lives in the Composer package so the PHP and JS ship together and can never drift in version. The @mesh alias points Vite at vendor/ethanbarlo/mesh/resources/js. There is no separate npm install step for the runtime.

Component ids

A component's id is a simple string, derived identically on both sides. The PHP component() method derives it from the class name relative to App\Mesh (App\Mesh\CounterCounter, App\Mesh\Forms\InputForms/Input), and the JS registry derives the same id from the folder path under the fixed resources/js/mesh directory. Because make:mesh StudlyCases both the class segments and the folder names, the two always agree. See building components for details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固