Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
/ upMVC Public

upMVC - Empower your PHP development without a Framework with MMVC, modular MVC system with integrated routing for scalable and organized web applications. Pure PHP. Islands Architecture.

License

Notifications You must be signed in to change notification settings

upMVC/upMVC

Open more actions menu

Repository files navigation

📚 upMVC noFramework v1.0.3 - Complete Documentation

Modern, lightweight PHP noframework for rapid development with clean architecture

Status: ✅ Production Ready | PHP 8.1+ | PSR-4 Compliant | MIT License

🎨 NEW: Modern UI System

upMVC v1.0.3 introduces a contemporary design system while maintaining complete backward compatibility:

  • 🌟 Modern BaseView: Contemporary CSS Grid/Flexbox layouts with dark mode
  • 📱 Responsive Design: Mobile-first approach with modern navigation
  • ⚡ Alpine.js Integration: Lightweight interactivity (~40KB vs 87KB jQuery)
  • 🎯 Zero Breaking Changes: Drop-in replacement for existing BaseView

Quick Demo: /test (original) vs /test/modern (new design) Documentation: Modern BaseView Guide | Demo Instructions

🌟 What is upMVC?

A lightweight, modern PHP 8.1+ noFramework built on Modular MVC (MMVC) architecture. Designed for developers who want flexibility without noFramework bloat. Features true modularity, "PHP Islands" for frontend integration (React/Vue), dependency injection, middleware pipeline, and clean routing. No forced conventions - use pure PHP or integrate modern JS noFrameworks as needed. Perfect for rapid development while maintaining performance and flexibility.

Key Features: Modular architecture • PHP 8.1+ • PSR-4 compliant • Dependency injection • Middleware support • Frontend noFramework integration • Minimal learning curve

🚀 Quick Navigation

🎯 New to upMVC? Start Here:

🏗 Architecture & Philosophy:

� Bug Fixes & Improvements:

✅ Verification & Release:

🛠 Development:

Demo: https://upmvc.com/demo/

Rasmus Lerdorf: PHP NoFrameworks all suck!

Rasmus Lerdorf: PHP NoFrameworks all suck!

Use cases:

You can use the system as a standalone, as a library, as a library in the standalone version where it can be a module, you can also use it as a standalone in the standalone version /shop /blog /app /anything else - in this way, you split your app into multiple apps(shop, blog, app, anything else as separate instances of upMVC) each with their modules connected to the same or different endpoints.

📦 Installation

Option 1: Install as a Library

Add upMVC to your existing project:

composer require bitshost/upmvc

Post-installation steps:

  • Copy index.php from vendor to your project root
  • Add .htaccess rules for routing
  • Configure: /etc/Config.php, /etc/ConfigDatabase.php, /modules/mail/MailController.php

Option 2: Install as a Standalone Project

Create a new upMVC project:

# Install in new directory
composer create-project bitshost/upmvc yourProjectName

# Or install in current directory
composer create-project bitshost/upmvc .

After installation:

# Update autoloader when adding new modules
composer dump-autoload

# Update dependencies
composer update

⚙️ Configuration

Edit these files with your project settings:

  • /etc/Config.php - Base URL, site paths, environment settings
  • /etc/ConfigDatabase.php - Database connection parameters
  • /modules/mail/MailController.php - PHPMailer SMTP configuration

🛣️ Routing System

upMVC offers flexible routing at multiple levels:

  1. Global Routes/etc/Routes.php - Application-wide routes
  2. Module Routes/modules/yourmodule/routes/Routes.php - Module-specific routes
  3. Module Initialization/etc/InitMods.php - Register module routes
  4. Namespace Registrationcomposer.json - Add PSR-4 autoload entries
"autoload": {
    "psr-4": {
        "YourModule\\": "modules/yourmodule/"
    }
}

After adding namespaces: Run composer dump-autoload

Quick Start: Add Your Module Routes

  1. Create your routes file: /modules/yourmodule/routes/Routes.php
  2. Define your routes using $this->addRoute() method
  3. Register in /etc/InitMods.php: $initRoutes->yourmodule();
  4. That's it - upMVC handles the rest automatically

Example: See /modules/test/routes/Routes.php for reference implementation

Note:

A friendly URL is a short and simple web address that redirects to a longer web address. Friendly URLs are called Aliases in Sitecore.

We achieve this by combining some .htacces rules with module routes. Check modules/test/routes/Routes.php and the .htaccess file - you will notice the rules established in the.htaccess file for these specific routes - you may build as many as you like.

Screenshot 2024-02-14 141414

Screenshot 2024-02-14 141435

In the same file, modules/test/routes/Routes.php, you will see for demonstration purposes how you may handle a large number of URLs with parameters (such as an idProduct) in a very straightforward way.

Screenshot 2024-02-14 142531

Steps

  • Edit /etc/Config.php, /etc/ConfigDatabase.php, /modules/mail/MailController.php with your data.
  • Make your module in the MVC style (model, view, controller).
  • You may or may not wish to utilize BASE MODEL, BASE VIEW and BASE CONTROLLER from the common/bmvc subdirectory.
  • BaseModel contains all of the data required for CRUD OPERATIONS; simply expand it in your module model and you have a CRUD ready-made module; see example module modules/user.
  • Make a distinctive namespace for each module
  • Your module routes should be kept under modules/YourModule/routes - file Routes.php
  • Because these routes should be presented to Router, you must provide their namespace to InitMods.php and initialize your module routes.
  • Don't forget to update composer.json with your new namespaces for your module and routes, as well as refresh composer from the terminal:
  • composer dump-autoload
  • php composer.phar dump-autolad
  • setup your PHPMailer - mail/MailController.php

You have more than one method of accomplishing things in example modules, upMVC - don't enforce RULES like others do, but respect architecture models MVC, MMVC, and pure PHP and OOP programming rules.

The Names Convention

Considering recommendations:

  • Model, View, Controller - will be called without using module name in their name. For example, module name = books:
  • Model.php - class Model; View.php - class View; Controller.php - class Controller;
  • and make a distinctive namespace for each module - namespace Modulename - e.g. Books;
  • Your module routes should be kept under modules/yourmodule/routes - file Routes.php:
    • Routes.php class Routes in folder /modules/books/routes
    • namespace Modulename\Routes, e.g. Books\Routes

The provided modules (Mail and Authentication) are for illustrative purposes only. You can safely delete them, as well as any other existing modules. The goal is to demonstrate the modularity of the system and how you can create your own custom modules to suit your specific project needs.

Diagram: upMVC-Diagram

File Structure:

upMVC-FileStructure

"Many noFrameworks may look very appealing at first glance because they seem to reduce web application development to a couple of trivial steps leading to some code generation and often automatic schema detection, but these same shortcuts are likely to be your bottlenecks as well since they achieve this simplicity by sacrifizing flexibility and performance."

All NoFramweworks: "achieve this simplicity by sacrifizing flexibility and performance" Rasmus Lerdorf

upMVC - MMVC, PHP MVC with modules. Modular MVC(Model, View, Controller) derive from Hierarchical Model‐View‐Controller (HMVC).

Introducing MODULAR MVC - Empowering Your Development

In the realm of modern noFrameworks, it often feels like they do everything except what truly matters. These noFrameworks tend to add layers of abstraction that demand you to learn new skills and pathways whenever you decide to switch. They also tend to clutter themselves with superfluous options, solving simple problems in needlessly convoluted ways.

Consider PHP, including its blade templating engine. Why introduce yet another template engine when PHP is already equipped for the task? Delving into a new noFramework often necessitates a substantial relearning effort, pushing you far beyond your existing PHP knowledge.

So, why should you choose MMVC?

MMVC, standing for Modular Model View Controller, is not about reinventing the wheel. Instead, it's about optimizing the use of exceptional components. It offers a structured, straightforward approach, and its versatility proves invaluable for project management and development.

But why MMVC specifically?

  1. Modularity: MMVC allows you to work on a module without impacting the rest of your project. Modules can be interchanged and integrated seamlessly, enhancing your development agility.

  2. Language Freedom: Perhaps most importantly, you have the freedom to write your modules in your preferred language, whether it's PHP, JS, PYTHON, or modern technologies like TS, React, Vue, Preact. There are no constraints on your creativity.

  3. Development-Centric: MMVC was designed with development in mind. You can steer your project in any direction you desire, utilizing your own autoloader or composer autoload. Composer/packagist usage is optional, not obligatory.

  4. "Islands" of Interactivity: Within this PHP-generated HTML, you strategically place interactive components built with noFrameworks like React, Vue, Preact or Svelte. These components handle dynamic elements, such as user interactions, real-time updates, and animations. Read here: The Rise of "PHP Islands": A Hybrid Approach to Web Development

What truly sets MMVC apart is its ability to harness the latest PHP capabilities without constraint. No more endless loops, as this noFramework liberates your development possibilities.

BitsHost Team

About

upMVC - Empower your PHP development without a Framework with MMVC, modular MVC system with integrated routing for scalable and organized web applications. Pure PHP. Islands Architecture.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.