PHP Classes

upMVC: noFramework to develop MMVC-based PHP applications

Recommend this page to a friend!
  Info   View files Example   Demos   View files View files (108)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (4)    
Last Updated Ratings Unique User Downloads Download Rankings
2024-05-16 (21 hours ago) RSS 2.0 feedNot enough user ratingsTotal: 75 This week: 14All time: 10,174 This week: 8Up
Version License PHP version Categories
upmvc 1.8Freely Distributable8Libraries, Design Patterns, PHP 8
Description 

Author

This package provides a system for building MMVC(Modular MVC)--based PHP applications, offering a structured approach to development.

It provides base model, view, and controller classes that application developers can extend to implement model, view, and controller classes specific to the application.

The package also provides additional modules with model, view, and controller classes to implement everyday tasks that many applications need, for instance:

- User authentication

- Email delivery

- User interface rendering using React.js

- User management

A module can take various forms, including a Single Page Application (SPA), a REACT app, TypeScript (TS), JavaScript (JS), or even an API module responding to requests across modules, eliminating the need for direct SQL queries if desired.

Picture of Adrian M
  Performance   Level  
Name: Adrian M <contact>
Classes: 4 packages by
Country: Ireland Ireland
Age: 43
All time rank: 38924 in Ireland Ireland
Week rank: 9 Up1 in Ireland Ireland Up

Instructions

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

The reasoning behind upMVC is as follows: The Modular MVC, which naturally evolved from HMVC with few changes, is the system power.

Modular MVC is built utilizing the HMVC architecture. It would be best to employ powerful architectural models to have order, not merely your soul's desires. Because readers, users, and developers must understand the system.

The rationale behind upMVC lies in creating the Modular MVC, a natural progression from HMVC with minimal alterations that constitute the system's backbone.

Modular MVC is constructed upon the robust architecture of HMVC.

To establish order, it is imperative to employ potent architectural models, transcend personal preferences, and align with the imperative for readers, users, and developers to comprehend the system.

The proliferation of frameworks, often challenging to grasp, underscores a prevalent issue. Many frameworks lack a solid architectural foundation, usually crafted by developers entrenched in their coding habits, indifferent to theoretical underpinnings.

This phenomenon is akin to musicians excelling in performance despite limited knowledge of music theory.

However, it is their chosen path, and one is not obliged to follow it. Recognizing coding as a form of freedom with inherent constraints is crucial. To truly understand a problem, one must delve into its source. PHP 8 excels across various facets, yet introducing excessive abstraction layers can complicate matters, not due to PHP itself but the layers built upon it.

In the index.php file, all requests are forwarded to the router only after the dispatcher() determines the existence of the requested route.

By utilizing initMODS instead of listing routes individually, all known routes set by the system administrator for both the system and its modules and those set by users for their modules are initialized.

Each module possesses its set of routes to maintain independence from primary routes.

This allows the system administrator to empower developers to code modules and add custom routes if desired. When working on a sample or test module, the system remains unaffected.

The standard/bmvc (Base MVC) provides a foundation with baseModel, baseView, and baseController.

Although not obligatory, these components can streamline tasks such as CRUD operations.

For instance, expanding the base model in your model grants access to pre-built CRUD queries.

Additional functionalities can be incorporated by creating custom queries in your module controller.

Numerous models, views, and controllers within modules showcase diverse ways to utilize them, all governed by the central principle of MVC.

The controller orchestrates the flow, sending data to the model and view, processing it, and transmitting it to the web.

Modules, in essence, function as self-contained applications within the overarching app.

They can interact with the entire system or specific sections using SQL or APIs like HASURA or stepZen—a facet that will be explored further in future discussions.

A module can take various forms, including a Single Page Application (SPA), a REACT app, TypeScript (TS), JavaScript (JS), or even an API module responding to requests across modules, eliminating the need for direct SQL queries if desired.

Example

<?php
/*
 * Created on Tue Oct 31 2023
 
 * Copyright (c) 2023 BitsHost
 * All rights reserved.

 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:

 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.

 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 * Here you may host your app for free:
 * https://bitshost.biz/
 */
//


require 'vendor/autoload.php';

use
upMVC\Start;

$fireUpMVC = new Start();
$fireUpMVC->upMVC();


?>


Details

upMVC - BitsHost MMVC

Modular MODEL VIEW CONTROLLER with Router

/*

* Created on Tue Oct 31 2023 * * Copyright (c) 2023 BitsHost

*/

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


Rasmus Lerdorf: PHP Frameworks all suck!

https://www.youtube.com/watch?v=DuB6UjEsY_Y&ab_channel=matperino

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 frameworks, it often feels like they do everything except what truly matters. These frameworks 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 framework 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 and React. 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.

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

Install:

composer require bitshost/upmvc

or

composer create-project --prefer-dist --stability=dev bitshost/upmvc yourfolder

Settings:

	

etc/Config.php

etc/Database.php

	

Add routes:

1 - General Routes - > etc/Routes.php

2 - Specific Routes(specific routing) - > modules/yourmodule/routes/Routes.php

3 - Adding module routes in Modules Initialiser - > etc/InitMods.php

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.

<img width="482" alt="Screenshot 2024-02-14 141414" src="https://github.com/upMVC/upMVC/assets/23263143/7494c92d-5fb8-4246-9e1a-12cd08edf21c">

<img width="550" alt="Screenshot 2024-02-14 141435" src="https://github.com/upMVC/upMVC/assets/23263143/f0c30024-f382-405d-8c75-880b9fd385d7">

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.

<img width="550" alt="Screenshot 2024-02-14 142531" src="https://github.com/upMVC/upMVC/assets/23263143/d5e155b2-92f8-4034-9fc8-1267efdbbf23">

Steps

- 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 by 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

BitsHost Team

Diagram: upMVC-Diagram

File Structure:

upMVC-FileStructure


  upMVC DEMOExternal page  

Open in a separate window

  Files folder image Files  
File Role Description
Files folder imagecommon (1 file, 2 directories)
Files folder imageetc (7 files)
Files folder imagemodules (9 directories)
Files folder imagevendor (1 file, 1 directory)
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  common  
File Role Description
Files folder imageassets (1 file)
Files folder imagebmvc (3 files)
  Accessible without login Plain text file 404.php Aux. Auxiliary script

  Files folder image Files  /  common  /  assets  
File Role Description
  Accessible without login Plain text file CommonCss.php Class Class source

  Files folder image Files  /  common  /  bmvc  
File Role Description
  Accessible without login Plain text file BaseController.php Class Class source
  Accessible without login Plain text file BaseModel.php Class Class source
  Accessible without login Plain text file BaseView.php Class Class source

  Files folder image Files  /  etc  
File Role Description
  Accessible without login Plain text file Config.php Class Class source
  Accessible without login Plain text file Database.php Class Class source
  Accessible without login Plain text file InitMods.php Class Class source
  Accessible without login Plain text file Router.php Class Class source
  Accessible without login Plain text file Routes.php Class Class source
  Accessible without login Plain text file sample.sql Data Auxiliary data
  Accessible without login Plain text file Start.php Class Class source

  Files folder image Files  /  modules  
File Role Description
Files folder imageauth (3 files, 1 directory)
Files folder imagemail (1 file, 2 directories)
Files folder imagemoda (3 files, 2 directories)
Files folder imagenew (3 files, 1 directory)
Files folder imagereact (3 files, 2 directories)
Files folder imagereactb (3 files, 2 directories)
Files folder imagereactcrud (3 files, 2 directories)
Files folder imagetest (3 files, 1 directory)
Files folder imageuser (3 files, 2 directories)

  Files folder image Files  /  modules  /  auth  
File Role Description
Files folder imageroutes (1 file)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file Model.php Class Class source
  Accessible without login Plain text file View.php Class Class source

  Files folder image Files  /  modules  /  auth  /  routes  
File Role Description
  Accessible without login Plain text file Routes.php Class Class source

  Files folder image Files  /  modules  /  mail  
File Role Description
Files folder imagephpmailer (7 files)
Files folder imageroutes (1 file)
  Accessible without login Plain text file MailController.php Class Class source

  Files folder image Files  /  modules  /  mail  /  phpmailer  
File Role Description
  Accessible without login Plain text file DSNConfigurator.php Class Class source
  Accessible without login Plain text file Exception.php Class Class source
  Accessible without login Plain text file OAuth.php Class Class source
  Accessible without login Plain text file OAuthTokenProvider.php Class Class source
  Accessible without login Plain text file PHPMailer.php Class Class source
  Accessible without login Plain text file POP3.php Class Class source
  Accessible without login Plain text file SMTP.php Class Class source

  Files folder image Files  /  modules  /  mail  /  routes  
File Role Description
  Accessible without login Plain text file MailRoutes.php Class Class source

  Files folder image Files  /  modules  /  moda  
File Role Description
Files folder imagemodules (1 directory)
Files folder imageroutes (1 file)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file Model.php Class Class source
  Accessible without login Plain text file View.php Example Example script

  Files folder image Files  /  modules  /  moda  /  modules  
File Role Description
Files folder imagesuba (3 files, 1 directory)

  Files folder image Files  /  modules  /  moda  /  modules  /  suba  
File Role Description
Files folder imageroutes (1 file)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file Model.php Class Class source
  Accessible without login Plain text file View.php Example Example script

  Files folder image Files  /  modules  /  moda  /  modules  /  suba  /  routes  
File Role Description
  Accessible without login Plain text file Routes.php Class Class source

  Files folder image Files  /  modules  /  moda  /  routes  
File Role Description
  Accessible without login Plain text file Routes.php Class Class source

  Files folder image Files  /  modules  /  new  
File Role Description
Files folder imageroutes (1 file)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file Model.php Class Class source
  Accessible without login Plain text file View.php Class Class source

  Files folder image Files  /  modules  /  new  /  routes  
File Role Description
  Accessible without login Plain text file Routes.php Class Class source

  Files folder image Files  /  modules  /  react  
File Role Description
Files folder imageetc (2 files)
Files folder imageroutes (1 file)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file Model.php Class Class source
  Accessible without login Plain text file View.php Class Class source

  Files folder image Files  /  modules  /  react  /  etc  
File Role Description
  Accessible without login Plain text file component.js Data Auxiliary data
  Accessible without login Plain text file Component.php Class Class source

  Files folder image Files  /  modules  /  react  /  routes  
File Role Description
  Accessible without login Plain text file Routes.php Class Class source

  Files folder image Files  /  modules  /  reactb  
File Role Description
Files folder imageetc (1 directory)
Files folder imageroutes (1 file)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file Model.php Class Class source
  Accessible without login Plain text file View.php Class Class source

  Files folder image Files  /  modules  /  reactb  /  etc  
File Role Description
Files folder imagebuild (7 files, 1 directory)

  Files folder image Files  /  modules  /  reactb  /  etc  /  build  
File Role Description
Files folder imagestatic (2 directories)
  Accessible without login Plain text file asset-manifest.json Data Auxiliary data
  Accessible without login Image file favicon.ico Data Auxiliary data
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Image file logo192.png Icon Icon image
  Accessible without login Image file logo512.png Data Auxiliary data
  Accessible without login Plain text file manifest.json Data Auxiliary data
  Accessible without login Plain text file robots.txt Doc. Documentation

  Files folder image Files  /  modules  /  reactb  /  etc  /  build  /  static  
File Role Description
Files folder imagecss (2 files)
Files folder imagejs (5 files)

  Files folder image Files  /  modules  /  reactb  /  etc  /  build  /  static  /  css  
File Role Description
  Accessible without login Plain text file main.f855e6bc.css Data Auxiliary data
  Accessible without login Plain text file main.f855e6bc.css.map Data Auxiliary data

  Files folder image Files  /  modules  /  reactb  /  etc  /  build  /  static  /  js  
File Role Description
  Accessible without login Plain text file 787.d4aba7ab.chunk.js Data Auxiliary data
  Accessible without login Plain text file 787.d4aba7ab.chunk.js.map Data Auxiliary data
  Accessible without login Plain text file main.10d2eb17.js Data Auxiliary data
  Accessible without login Plain text file main.10d2eb17.js.LICENSE.txt Doc. Documentation
  Accessible without login Plain text file main.10d2eb17.js.map Data Auxiliary data

  Files folder image Files  /  modules  /  reactb  /  routes  
File Role Description
  Accessible without login Plain text file Routes.php Class Class source

  Files folder image Files  /  modules  /  reactcrud  
File Role Description
Files folder imageetc (1 directory)
Files folder imageroutes (1 file)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file Model.php Class Class source
  Accessible without login Plain text file View.php Class Class source

  Files folder image Files  /  modules  /  reactcrud  /  etc  
File Role Description
Files folder imagebuild (9 files, 1 directory)

  Files folder image Files  /  modules  /  reactcrud  /  etc  /  build  
File Role Description
Files folder imagestatic (2 directories)
  Accessible without login Plain text file asset-manifest.json Data Auxiliary data
  Accessible without login Image file favicon.ico Data Auxiliary data
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Image file logo192.png Icon Icon image
  Accessible without login Image file logo512.png Data Auxiliary data
  Accessible without login Plain text file manifest.json Data Auxiliary data
  Accessible without login Plain text file precache-manifest....0998b450cbbdaffd.js Data Auxiliary data
  Accessible without login Plain text file robots.txt Doc. Documentation
  Accessible without login Plain text file service-worker.js Data Auxiliary data

  Files folder image Files  /  modules  /  reactcrud  /  etc  /  build  /  static  
File Role Description
Files folder imagecss (4 files)
Files folder imagejs (6 files)

  Files folder image Files  /  modules  /  reactcrud  /  etc  /  build  /  static  /  css  
File Role Description
  Accessible without login Plain text file 2.326c04ff.chunk.css Data Auxiliary data
  Accessible without login Plain text file 2.326c04ff.chunk.css.map Data Auxiliary data
  Accessible without login Plain text file main.b1413f35.chunk.css Data Auxiliary data
  Accessible without login Plain text file main.b1413f35.chunk.css.map Data Auxiliary data

  Files folder image Files  /  modules  /  reactcrud  /  etc  /  build  /  static  /  js  
File Role Description
  Accessible without login Plain text file 2.b5004239.chunk.js Data Auxiliary data
  Accessible without login Plain text file 2.b5004239.chunk.js.map Data Auxiliary data
  Accessible without login Plain text file 3.9973b74a.chunk.js Data Auxiliary data
  Accessible without login Plain text file 3.9973b74a.chunk.js.map Data Auxiliary data
  Accessible without login Plain text file main.dc560686.chunk.js Data Auxiliary data
  Accessible without login Plain text file main.dc560686.chunk.js.map Data Auxiliary data

  Files folder image Files  /  modules  /  reactcrud  /  routes  
File Role Description
  Accessible without login Plain text file Routes.php Class Class source

  Files folder image Files  /  modules  /  test  
File Role Description
Files folder imageroutes (1 file)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file Model.php Class Class source
  Accessible without login Plain text file View.php Class Class source

  Files folder image Files  /  modules  /  test  /  routes  
File Role Description
  Accessible without login Plain text file Routes.php Class Class source

  Files folder image Files  /  modules  /  user  
File Role Description
Files folder imageetc (2 files)
Files folder imageroutes (1 file)
  Accessible without login Plain text file Controller.php Class Class source
  Accessible without login Plain text file Model.php Class Class source
  Accessible without login Plain text file View.php Class Class source

  Files folder image Files  /  modules  /  user  /  etc  
File Role Description
  Accessible without login Plain text file script.js Data Auxiliary data
  Accessible without login Plain text file styles.css Data Auxiliary data

  Files folder image Files  /  modules  /  user  /  routes  
File Role Description
  Accessible without login Plain text file Routes.php Class Class source

  Files folder image Files  /  vendor  
File Role Description
Files folder imagecomposer (8 files)
  Accessible without login Plain text file autoload.php Aux. Auxiliary script

  Files folder image Files  /  vendor  /  composer  
File Role Description
  Accessible without login Plain text file autoload_classmap.php Aux. Auxiliary script
  Accessible without login Plain text file autoload_namespaces.php Aux. Auxiliary script
  Accessible without login Plain text file autoload_psr4.php Aux. Auxiliary script
  Accessible without login Plain text file autoload_real.php Class Class source
  Accessible without login Plain text file autoload_static.php Class Class source
  Accessible without login Plain text file ClassLoader.php Class Class source
  Accessible without login Plain text file LICENSE Lic. License text
  Accessible without login Plain text file platform_check.php Aux. Auxiliary script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:75
This week:14
All time:10,174
This week:8Up