almhdy24/php-mini-mvc 问题修复 & 功能扩展

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

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

almhdy24/php-mini-mvc

Composer 安装命令:

composer create-project almhdy24/php-mini-mvc

包简介

Professional PHP Mini MVC Skeleton

README 文档

README

PHP Composer License

This is a simple, clean, and lightweight MVC (Model-View-Controller) starter kit built specifically for PHP 8+. It is perfect if you want to build a small-to-medium web project without the complexity or weight of a huge framework. It keeps things fast, organized, and easy to understand.

📑 Table of Contents

✨ Features

  • 🏗️ Classic MVC Pattern: Clear separation of concerns between logic, data, and presentation.
  • 📦 PSR-4 Autoloading: Modern class loading using Composer.
  • 🛣️ Custom Router: Lightweight URL routing with support for dynamic parameters (e.g., /users/{id}).
  • 🗄️ Base Model (PDO): Ready-to-use SQLite integration with common CRUD operations.
  • 🛡️ Error Handling: Custom exception and error handling for cleaner debugging.
  • Zero Bloat: Extremely minimal codebase; perfect for rapid prototyping.

🛠️ Tech Stack

  • Language: PHP 8+
  • Package Manager: Composer
  • Database: SQLite (default)
  • Architecture: MVC

📥 Installation

  1. Clone the repository:

    git clone https://github.com/almhdy24/php-mini-mvc.git
    cd php-mini-mvc
  2. Install dependencies:

    composer install
  3. Start the local server:

    php -S localhost:8000 -t public
  4. Access the application at http://localhost:8000.

💡 Usage

Adding a New Route

Edit routes/web.php to map URLs to Controllers:

$router->get('/profile', ['ProfileController', 'index'], 'profile');

Creating a Controller

Create a new file in app/Controllers/ extending App\Core\Controller:

namespace App
aulControllers;
use App\Core\Controller;

class ProfileController extends Controller {
    public function index() {
        $this->view('profile', ['user' => 'John Doe']);
    }
}

📁 Project Structure

Path Description
/app Core application logic (Controllers, Models, Views)
/config Application configuration files
/public Entry point of the application (index.php)
/routes Route definitions
/storage SQLite database file storage

📜 License

Distributed under the MIT License. See LICENSE for more information.

🔗 Important Links

Built with ❤️ by almhdy24 | View on GitHub

If you find this project useful, please consider giving it a star! 🌟

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固