rapo/framework 问题修复 & 功能扩展

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

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

rapo/framework

Composer 安装命令:

composer require rapo/framework

包简介

A modern, lightweight PHP framework designed to bring the Next.js developer experience to the PHP world.

README 文档

README

rapophpbanner

RapoPHP is a modern, lightweight PHP framework designed to bring the Next.js developer experience to the PHP world. It moves away from traditional MVC patterns in favor of a component-centric architecture, file-based routing, and built-in reactivity.

⚠️ Warning: RapoPHP is in early development. APIs and features may change significantly and security improvements are ongoing. Use at your own risk.

Key Modern Features

Zero-Config File-based Routing (Next.js App Router Style)

  • Folder-Based URL Segments: Your directory structure in src/Pages directly maps to URLs.
  • Routable Files: A route is only public if it contains a Page.php or Index.php. Colocate other files (components, tests) safely.
  • Private Folders: Prefix folders with _ (e.g., _components) to opt them out of routing.
  • Route Groups: Wrap folders in () (e.g., (marketing)) to organize routes without affecting the URL.
  • Dynamic Routes: Full support for [slug] and catch-all [...slug] segments.
  • Special Files: Built-in support for Layout.php, Template.php, Error.php, NotFound.php, Loading.php, and Action.php at any level.
  • Hierarchical Layouts & Middleware: Layouts and Middleware nest automatically following the folder structure.
  • Server Actions: Define server-side logic in Action.php to handle form submissions directly in your route folder.

Component-Centric UI

  • Pages as Components: Forget controllers. A page is just a PHP class extending Component.
  • JSX-style PHP: Use the h() helper for a declarative way to build HTML.
  • Functional Hooks:
    • useRouter(): Access routing data and navigation.
    • useHead(): Declarative metadata management.
    • useState(): Persisted state across requests.
    • useForm(): Simplified form handling and validation.
    • useSession(): Easy session management.
    • useCache(): Access to the built-in caching layer.
  • Nested Layouts: Intuitively wrap pages with layouts at any level.

Performance & DX

  • Rapo-Live: Livewire-style server-side reactivity for interactive components.
  • Data Fetching: Built-in getServerSideProps for pre-rendering data.
  • ISR & Caching: Incremental Static Regeneration support for blazing fast load times via the built-in Cache service.
  • Modern CLI: Scaffolding for pages, components, models, middleware, and server actions.
  • Image Optimization: Built-in Image component for lazy-loading and optimization.
  • Mail Engine: Professional email handling using Symfony Mailer, powered by Rapo Components.
  • Context Debugger: A built-in floating badge in debug mode to inspect component props and route hierarchy.
  • Quality Tools: Built-in dd() and dump() helpers via Symfony Var-Dumper.

Modern Data & Auth

  • Active Record ORM: A fluent way to interact with your database.
  • Automatic Migrations: Define your schema in models and sync effortlessly.
  • Auth Scaffolding: Get a full authentication system running in seconds.
  • Storage Abstraction: Simplified file management with storage() helper and useStorage() hook.
  • Background Queues: Handle heavy tasks out-of-process with the SQLite-based queue() system.
  • Attribute-based Validation: Cleanly validate requests using PHP 8 Attributes: #[Validate(['email' => 'required|email'])].

Rapo-Only Unique Features

Hierarchical i18n

Translations that follow your folder structure. Place translation.php in any route folder, and use the useTranslation() hook. It automatically merges translations from the current page up to the root.

Automatic Page-to-API Mirroring

Every page is an API. Request any page with Accept: application/json and RapoPHP will return the props and getServerSideProps data as JSON instead of HTML.

Markdown-as-Routes

Create docs effortlessly. Create Page.md in any route folder, and RapoPHP will automatically parse and render it.

Installation

The recommended way to install RapoPHP is via Composer:

composer require rapo/framework
php vendor/bin/rapo project:init

CLI Commands

After initializing your project, you can use the Rapo CLI:

# Start the development server
php vendor/bin/rapo serve

# Create a dynamic page: src/Pages/blog/[slug]/Page.php
php vendor/bin/rapo make:page blog/[slug]

# Create a new component
php vendor/bin/rapo make:component Navbar

# Create an API route
php vendor/bin/rapo make:api-route status

# Create a Server Action
php vendor/bin/rapo make:action contact

# Run migrations
php vendor/bin/rapo migrate

# Start queue worker
php vendor/bin/rapo queue:work

Advanced Features

Server Actions & Validation

Handle forms with zero-config using Action.php and declarative validation:

namespace App\Pages\contact;

use Rapo\Http\Attributes\Validate;

class Action {
    #[Validate(['email' => 'required|email', 'msg' => 'required'])]
    public function handle($request) {
        // Logic here...
        return redirect('/thanks');
    }
}

Background Jobs

Keep your app fast by offloading heavy tasks:

// Dispatch to queue
queue(SendEmailJob::class, ['to' => 'user@example.com']);

Storage

Easily manage files across different environments:

storage()->put('uploads/photo.jpg', $binaryData);
$url = storage()->url('uploads/photo.jpg');

Built with ❤️ for PHP developers who love modern workflows.

rapo/framework 适用场景与选型建议

rapo/framework 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「framework」 「php」 「components」 「file-based-routing」 「nextjs-style」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 rapo/framework 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-24