Skip to content

edigar/noobframework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Noobframework

NoobFramework is an MVC framework designed specifically for beginners. It serves as an educational tool for those learning the MVC design pattern in PHP.

MVC

MVC stands for Model-View-Controller, which is a widely-used software design pattern. Its fundamental concept involves dividing an application into three interconnected components:

  • Model: Responsible for handling data manipulation, including reading, writing, and validation.
  • View: Represents the user interface layer, responsible solely for presenting data to the user.
  • Controller: Acts as an intermediary between the user and the application's logic. It receives user input, determines which model to interact with, and selects the appropriate view to render. Controllers contain methods known as actions.

Requirements

Installation

Clone or download this repository and install dependencies:

composer install

Choose one of the following options (Built-in server or Docker), to run the project.

Built-in server

If you prefer to use PHP's built-in server for local development, navigate to the root of the project and run:

php -S localhost:8000

Docker

For Docker users, a Dockerfile is provided at the root of the project with the necessary configurations to run the framework. To use Docker:

  1. Build the Docker image:
docker build -t noobframework .
  1. Run the Docker container:
docker run -d --name noobframework -p 80:80 -v $(pwd):/var/www/html noobframework

Usage

  1. Develop your application within the app folder. This folder is organized into Controllers, Models, and Views.
  2. The public folder serves as the document root for your application.
  3. Generate a .env file based on .env.example (copy, paste and rename it), then configure your application settings within it.
  4. Define your routes in the route/router.php file. Routing follows the features of nikic/fast-route.
  5. To create a controller, add a new file inside app/Controller, similar to existing controllers (e.g., indexController.php). Similarly, add your models inside the Models folder and create views following the examples provided in the views folder.
  6. Each controller can contain multiple actions (methods) corresponding to different user interactions.

For more, see documentation.

About

A PHP MVC Framework for Beginners

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •