承接 dotari/php-app 相关项目开发

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

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

dotari/php-app

Composer 安装命令:

composer create-project dotari/php-app

包简介

PHPapp is a lightweight PHP framework designed for quick and efficient web application development. It follows the MVC architecture and provides core components for database interaction, session management, request handling, and more.

README 文档

README

PHPapp is a lightweight PHP framework designed for quick and efficient web application development. It follows the MVC (Model-View-Controller) architecture and provides core components for data management, routing, and user interaction.

@and-ri: Hello everyone! I am very excited to share with you a version of my PHP framework. Maybe it is far from such giants as Laravel or Yii, but it has become very convenient for me. Especially for quick prototyping and small applications.

I will be happy for any contribution :)

Features

  • MVC Architecture: Clean separation of concerns with models, views, and controllers to organize code logically.
  • Core Components: Includes essential libraries for handling sessions, database connections, request processing, and URL routing.
  • Secure by Default: Twig auto-escaping, CSRF tokens, hardened sessions, and strict route validation out of the box.
  • Modern Frontend Build: Tailwind CSS 4 + daisyUI bundled with Vite, with automatic cache busting.
  • Migration System: Built-in system for managing database schema changes and versioning.
  • Installer: Interactive installer for quick setup, including .env generation, Composer installation, and database migration execution.
  • Easy to Install and Configure: Minimal setup required for developers to get started quickly.

Requirements

  • PHP 8+
  • A web server (e.g., Apache, Nginx)
  • MySQL
  • Node.js 20+ and npm (only for building frontend assets)

Installation

  1. Clone the repository:

    git clone https://github.com/and-ri/phpapp.git
  2. Navigate to the project directory:

    cd phpapp
  3. Install dependencies and build frontend assets:

    composer install
    npm install
    npm run build
  4. Run the installer: Open http://yourdomain.com/installer.php in your browser and follow the on-screen instructions to set up the database and configuration.

  5. Done! For security, delete installer.php from the www directory after installation (it refuses to run again while .env exists, but removing it entirely is safer).

Frontend Assets

Frontend sources live in static/css/style.css and static/js/app.js and are bundled by Vite (Tailwind CSS 4 + daisyUI) into www/assets/:

npm run dev    # rebuild automatically on changes (vite build --watch)
npm run build  # one-off production build

Templates reference the built assets through $this->staticfile->getAssetUri('css/app.css'), which appends a cache-busting ?v=<timestamp> parameter. The built files in www/assets/ are committed to the repository, so remember to run npm run build before committing frontend changes.

Templating and Security

  • Twig auto-escaping is enabled: any variable printed with {{ ... }} is HTML-escaped. Pass trusted HTML (e.g. output of another controller) through $this->view->raw($html)Load::controller() already does this for you.
  • Every form should include the CSRF field with {{ csrf }} and validate it with $this->session->validateToken($this->request->post['csrf']) (see app/controller/catalog/csrf_protection.php for a complete example).
  • Request data ($this->request->get/post/cookie) is raw. Escape at the output layer: Twig handles HTML, and use $this->db->escape() or $this->db->execute($sql, $params) (prepared statements) for SQL.

Core Components

Classes

  • controller.php: Handles application logic, loading views and models.
  • model.php: Manages database interactions and data-related operations.
  • view.php: Renders views and passes data to the user interface.

Libraries

  • app.php: Manages the application lifecycle, including initialization and configuration.
  • cache.php: Simple file-based cache with optional TTL (get, set, delete, deleteAll).
  • db.php: Provides methods for database queries and connection handling, including prepared statements via execute().
  • env.php: Handles environment variables and configuration settings.
  • flash.php: One-time session messages for the POST -> redirect -> GET pattern.
  • google_auth.php: Handles the Google authentication process for the application.
  • language.php: Loads and manages language files for multi-language support.
  • load.php: Loads models and controllers dynamically.
  • mail.php: Sends email via SMTP or PHP mail() using PHPMailer (configured through .env).
  • pagination.php: Provides simple pagination functionality.
  • request.php: Handles incoming HTTP requests.
  • response.php: Manages HTTP responses and headers.
  • session.php: Facilitates session management (start, get, set, remove, etc.) and CSRF tokens.
  • staticfile.php: Serves static files (CSS, JS, images) and generates cache-busted URIs for built assets.
  • upload.php: Stores uploaded files safely (finfo MIME check, extension allowlist, random names).
  • url.php: Generates URLs and manages routing.
  • validator.php: Rule-based input validation (required|email|min:8|...) with per-field error messages.
  • log.php: Provides centralized logging functionality using Monolog.
  • meta.php: Manages SEO metadata including page titles, descriptions, Open Graph tags, and robots directives using the Melbahja/Seo package.

Migrations

Create a migration by copying migrations/template.php to a new file (e.g. migrations/2026_07_04_create_users.php). A migration returns an anonymous class with up() and down() methods:

return new class {
    public function up($db) {
        $db->query("CREATE TABLE ...");
    }

    public function down($db) {
        $db->query("DROP TABLE ...");
    }
};

Then run:

php migrate.php migrate   # apply pending migrations
php migrate.php rollback  # undo the last migration
php migrate.php status    # show applied and pending migrations

License

This project is licensed under the MIT License.

dotari/php-app 适用场景与选型建议

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

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

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

围绕 dotari/php-app 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-11