Code Monkey home page Code Monkey logo

tiny_mvc's Introduction

Tiny MVC project

Minimal functional MVC.

About project

This project implements tiny but functional MVC framework, including:

  • Simple HTTP request/response cycle handling
  • Simple Router
  • Simple templating (utilizing includes and output buffering)
  • DB connection
  • Various helper classes

Notice!

This project is meant to be used for educational purposes and is not 100% production ready!

If you use this project (or its part) for your application, keep in mind that this software is provided as is and all possible consequences of its usage (or its parts) in production environment are your responsibility!

Branches

main - current "stable" branch

commentary - branch with thoroughly commented code (TBD)

example-project - branch with example project built upon tiny_mvc (simple blog) (TBD)

Languages

This project is mainly focused on czech students/starting developers so all not prefixed branches will be documented in czech (TBD - right now it's mixed).

Branches prefixed with en/ will be documented in english.

Versions

Version branch with the highest version number is current work in progress branch.

versions/* - all past versions of the framework

commentary/* - commentary branches of past versions

Folder structure

tiny_mvc/
├── Core/
│   ├── Autoload/
│   ├── Database/
│   ├── Exceptions/
│   ├── Http/
│   ├── Persist/
│   ├── Routing/
│   ├── Security/
│   ├── Utils/
│   └── View/
├── public/
│   ├── resources/
│   └── index.php
└── src/
    ├── Controllers/
    ├── Models/
    ├── Routes/
    └── Views/

Core - tiny_mvc framework files
public - publicly accessible resources and entrypoint to app (index.php)
src - source code of application build upon the tiny_mvc

Tiny info - app architecture

MVC

Models are components which communicates with database.

Views are components which creates templates to be displayed to user.

Controllers are components which encapsulates business logic and secures communication between rest of system components (Models, Views, service classes, etc.).

7 RESTful actions

Method name HTTP method Description
index GET Render List of resources (posts etc.) -> main content.
show GET Render single resource (post).
create GET Render create Form.
edit GET Render edit Form.
store POST Store new data into DB.
update PATCH/PUT Update data in DB.
destroy DELETE Remove data from DB.

tiny_mvc's People

Contributors

jakubpradeniak avatar

Stargazers

J.Becvar avatar Kateřina Pleskačová avatar

Watchers

 avatar

tiny_mvc's Issues

Change DB destructor

Remove this:

public function __destruct()
{
    $this->connection = null;
}

use unset

Update README

Add recommended folder structure to main branch. Create czech version.

Create Route weights/precedence

Add simple way to create weights/precedence order for Routes to avoid this scenario:

  • /route/{id}
  • /route/{id}/edit

Secound route will never be reached if routes will be registered in this order.
In router we do not want to have this issue (order of registration should not matter!).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.