承接 arefshojaei/routex 相关项目开发

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

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

arefshojaei/routex

Composer 安装命令:

composer create-project arefshojaei/routex

包简介

A minimal PHP framework for base file routing

README 文档

README

PHP File based Routing

A lightweight file‑based Routing system inspired by Next.js, built with PHP and structured around the MVC architecture.

Routing patterns

pages/
|
├── index.php                →  /
├── about.php                →  /about
├── auth
|   |     
│   ├── login.php            →  /auth/login
│   └── register.php         →  /auth/register
| 
├── products 
|   |     
│   ├── index.php            →  /products
│   └── [id].php             →  /products/:id
| 
├── admin  
|   |    
│   └── [id]
|       |
│       └── dashboard.php    →  /admin/:id/dashboard
|

Folder structure (MVC)

Project
|
├── app/
│   ├── Controllers/
│   └── Models/
|
├── config/
│   └── app.php
│   └── database.php
│
├── pages/        (Views)
│   └── index.php
│
├── public/
│   ├── assets/
│   └── index.php
│
├── vendor/
├── .gitignore
├── composer.json
└── README.md

Installation

Composer

composer create-project arefshojaei/routex my-app

Github

git clone https://github.com/ArefShojaei/Routex/Routex.git

How to run the App?

You can use two ways for running such as:

Built-in PHP web-server

php -S [host]:[port] -t public/

Apache web-server

Soon...

How to use the MVC?

Model

app/Models/Post.php

<?php

namespace App\Models;

final class Product {
    public function __construct(
        public string $title,
        public float $price
    ) {}

    public function find() {...}
    public function save() {...}
    public function update() {...}
    public function remove() {...}
}

Controller

app/Controllers/PostController.php

<?php

namespace App\Controllers;

use Routex\Contracts\BaseController;
use Routex\Http\Request;

final class ProductController implements BaseController {
    public function __invoke(Request $request): array
    {
        return [
            "id" => 1,
            "title" => "Book",
            "price" => 99,
        ];
    }
}

View

app/pages/post.php

<?php

use App\Controllers\ProductController;
use Routex\View\Page;

extract(Page::resolve(ProductController::class));
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Product page</title>
</head>
<body>
    <div>
        <span><?= $id ?></span> 
        <h3><?= $title ?></h3>
        <p><?= $price ?></p>
    </div>
</body>
</html>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固