PHP Classes

File: docs/MODULE_PHILOSOPHY_UPDATE.md

Recommend this page to a friend!
  Packages of Adrian M   upMVC   docs/MODULE_PHILOSOPHY_UPDATE.md   Download  
File: docs/MODULE_PHILOSOPHY_UPDATE.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: upMVC
Pure PHP web development without other frameworks
Author: By
Last change: up
Date: 2 months ago
Size: 5,319 bytes
 

Contents

Class file image Download

Documentation Update Summary - Module Philosophy

? What Was Added

A comprehensive explanation of upMVC's modular philosophy and authentication approaches.

? Files Created/Updated

1. New File: docs/MODULE_PHILOSOPHY.md

Purpose: Explains that modules are reference implementations, not requirements

Key Sections: - Modules as Reference Implementations - Can delete any/all modules - What Each Module Demonstrates - Purpose of each included module - Two Authentication Approaches - Manual checks vs controller-level vs middleware - Choose Your Style - Comparison table of approaches - Minimal Installation - What you can safely delete - Learning Path - How to study and adopt patterns

Code Examples:

// Approach 1: Manual Check (react module)
if (isset($_SESSION["logged"])) {
    $view->View($reqMet);
} else {
    header('Location: ' . BASE_URL . '/');
    exit;
}

// Approach 2: Controller-Level (admin module)
public function display($reqRoute, $reqMet)
{
    if (!isset($_SESSION["logged"]) || $_SESSION["logged"] !== true) {
        header('Location: ' . BASE_URL . '/auth');
        exit;
    }
    // All methods below automatically protected
}

2. Updated: README.md

Added note after "What is upMVC?":

> ? Note: Included modules (admin, email, auth, react, etc.) are 
> reference implementations showing different approaches to common problems. 
> After installation, you can delete any modules you don't need - keep only 
> what serves your project.

Added to navigation:

- ? Module Philosophy - Modules as reference implementations

3. Updated: src/Modules/Admin/README.md

Added at top:

> ? Note: This module is a reference implementation. You can delete it 
> if you don't need admin functionality. It demonstrates: route caching, CRUD 
> operations, controller-level authentication, and flash messages. See 
> Module Philosophy for more.

Updated features list: - Added "controller-level check" to authentication feature - Added "Cached Routes" feature

4. Updated: docs/routing/README.md

Updated See Also section:

- Module Philosophy - Understanding reference implementations
- Admin Module Example - Cached routing in action

? Key Messages Communicated

1. Modules Are Optional

  • Not dependencies - Can delete any or all
  • Reference implementations - Examples, not requirements
  • Choose what fits - Keep only what you need

2. Multiple Valid Approaches

  • Manual session checks - Simple, explicit (react module)
  • Controller-level protection - DRY, automatic (admin module)
  • Middleware pipeline - Framework-like, advanced

3. Freedom to Choose

  • No "upMVC way" - Pick your style
  • All approaches valid - Choose based on project needs
  • Mix and match - Use different patterns in different modules

4. Learning by Example

  • Study included modules - See different solutions
  • Understand trade-offs - Pros/cons of each approach
  • Adopt patterns - Use what works for you
  • Delete the rest - Clean slate for your code

? Approach Comparison

| Approach | Complexity | Best For | Example Module | |----------|-----------|----------|----------------| | Manual Check | Low | Few protected routes | react | | Controller-Level | Medium | Module-wide protection | admin | | Middleware Pipeline | High | Large apps, complex auth | Custom |

? Philosophy Summary

upMVC Modules = Reference Implementations

Study them ? Learn patterns ? Delete them ? Build your way

That's the NoFramework philosophy!

? Documentation Structure

README.md
  ?? Links to: docs/MODULE_PHILOSOPHY.md
         ?
         ?? Explains: Modules are optional
         ?? Shows: Authentication approaches
         ?? Compares: Manual vs Controller vs Middleware
         ?? References: Admin module example
                  ?
                  ?? modules/admin/README.md
                       ?? Notes: Reference implementation
                       ?? Shows: Controller-level auth + cached routes

? Benefits

For New Users

  • ? Clear expectations - Modules are examples, not required
  • ? Multiple options - See different valid approaches
  • ? Learning path - Study ? Choose ? Delete ? Build

For Experienced Users

  • ? Flexibility - Delete what you don't need
  • ? No restrictions - Use any approach that fits
  • ? Clean slate - Start with minimal setup

For Framework Skeptics

  • ? True freedom - No forced patterns
  • ? Educational - Learn by example, not by rules
  • ? NoFramework - Tools and examples, not conventions

? Result

Users now understand that:

  1. Modules are educational - Study them, don't worship them
  2. You can delete everything - Keep only auth, or nothing at all
  3. Multiple approaches exist - All are valid, choose yours
  4. upMVC is truly flexible - No "right way", just options

Documentation is now complete and clear! ?