A quick and incomplete example of how to validate a form using a FormValidator class on the simple-mvc

Overview

Simple MVC

Description

This repository is a simple PHP MVC structure from scratch.

It uses some cool vendors/libraries such as Twig and Grumphp. For this one, just a simple example where users can choose one of their databases and see tables in it.

Steps

  1. Clone the repo from Github.
  2. Run composer install.
  3. Create config/db.php from config/db.php.dist file and add your DB parameters. Don't delete the .dist file, it must be kept.
define('APP_DB_HOST', 'your_db_host');
define('APP_DB_NAME', 'your_db_name');
define('APP_DB_USER', 'your_db_user_wich_is_not_root');
define('APP_DB_PASSWORD', 'your_db_password');
  1. Import database.sql in your SQL server, you can do it manually or use the migration.php script which will import a database.sql file.
  2. Run the internal PHP webserver with php -S localhost:8000 -t public/. The option -t with public as parameter means your localhost will target the /public folder.
  3. Go to localhost:8000 with your favorite browser.
  4. From this starter kit, create your own web application.

Windows Users

If you develop on Windows, you should edit you git configuration to change your end of line rules with this command :

git config --global core.autocrlf true

Example

An example (a basic list of items) is provided (you can load the simple-mvc.sql file in a test database). The accessible URLs are :

  • Home page at localhost:8000/
  • Items list at localhost:8000/items
  • Item details localhost:8000/items/show?id=:id
  • Item edit localhost:8000/items/edit?id=:id
  • Item add localhost:8000/items/add
  • Item deletion localhost:8000/items/delete?id=:id

You can find all these routes declared in the file src/routes.php. This is the very same file where you'll add your own new routes to the application.

How does URL routing work ?

simple_MVC.png

Ask for a tour !

Guided tour

We prepare a little guided tour to start with the simple-MVC.

To take it, you need to install the Code Tour extension for Visual Studio Code : Code Tour

It will give access to a new menu on your IDE where you'll find the different tours about the simple-MVC. Click on play to start one :

menu

Run it on docker

If you don't know what is docker, skip this chapter. ;)

Otherwise, you probably see, this project is ready to use with docker.

To build the image, go into the project directory and in your CLI type:

docker build -t simple-mvc-container .

then, run it to open it on your localhot :

docker run -i -t --name simple-mvc  -p 80:80 simple-mvc-container
You might also like...
Create a downloads list - quick and easy. With categories and mobile friendly design
Create a downloads list - quick and easy. With categories and mobile friendly design

Simple downloads list plugin for wordpress Create a downloads list - quick and easy. With categories and mobile friendly design What is Simple downloa

Example of using abrouter/abrouter-laravel-bridge in Laravel
Example of using abrouter/abrouter-laravel-bridge in Laravel

ABRouter Laravel Example It's a example of using (ABRouter Laravel Client)[https://github.com/abrouter/abrouter-laravel-bridge] Set up locally First o

Example of using TALL stack to select country phone code.
Example of using TALL stack to select country phone code.

Select country phone code using TALL stack About Example of using TALL stack to select country phone code. Each item represents a country. Each item h

Laravel package to generate and to validate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.

Laravel Uuid Laravel package to generate and to validate a universally unique identifier (UUID) according to the RFC 4122 standard. Support for versio

A Laravel wrapper for spatie/dns. Allows to query and validate DNS records.

A Laravel wrapper for spatie/dns. Allows to query and validate DNS records.

Login system designed by fragX to validate the user and prevent unauthorized access to confidential data.

Login_System v.0.1 Login system designed by fragX to validate the user and prevent unauthorized access to confidential data. 🧐 Features Sign In and S

A Laravel package that allows you to validate your config values and environment.
A Laravel package that allows you to validate your config values and environment.

Table of Contents Overview Installation Requirements Install the Package Publishing the Default Rulesets Usage Creating a Validation Ruleset Using the

A collection of classes to be extended/used in laravel apps for quick development

laraquick A collection of classes to be extended/used in laravel applications for quick development. Introduction The library contains traits with wel

Sample Content - PHP Retriever - Simple MVC Front Controller Mini Framework

### PHP-RETRIEVER AND SAMPLE CONTENT | SIMPLE MVC FRONT CONTROLLER MINI FRAMEWORK Version: 0.2 License: GPLv3 or later Requires at least: PHP 7.3+ Co

Owner
Romain Clair
Romain Clair
Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Jameson Lopp 28 Dec 19, 2022
A package to validate email domains in a user registration form

This package allows to define a subset of allowed email domains and validate any user registration form with a custom rule.

H-FARM 56 Jul 19, 2022
A package to validate email domains in a user registration form

Laravel Email Domain Rule This package allows to define a subset of allowed email domains and validate any user registration form with a custom rule.

H-FARM Innovation 56 Jul 19, 2022
Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.

TALL-stack form generator Laravel Livewire, Tailwind forms with auto-generated views. Support Contributions Features This is not an admin panel genera

TinaH 622 Jan 2, 2023
Simple project to send bulk comma-separated emails using laravel and messenger module from quick admin panel generator.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Novath Thomas 1 Dec 1, 2021
Validate your input data in a simple way, an easy way and right way. no framework required. For simple or large. project.

wepesi_validation this module will help to do your own input validation from http request POST or GET. INTEGRATION The integration is the simple thing

Boss 4 Dec 17, 2022
Otpify is a Laravel package that provides a simple and elegant way to generate and validate one time passwords.

Laravel Otpify ?? Introduction Otpify is a Laravel package that provides a simple and elegant way to generate and validate one time passwords. Install

Prasanth Jayakumar 2 Sep 2, 2022
🛂 Use this package to validate the identity card from your country using laravel validation rules.

Identity Card Checker Laravel Validation Rules Use this package to validate the identity card number from your country Installation You can install th

David Torralbo Pérez 13 Feb 8, 2022
A simple laravel package to validate console commands arguments and options.

Command Validator A simple laravel package to validate console commands arguments and options. Installation Require/Install the package using composer

Touhidur Rahman 20 Jan 20, 2022
A Formatter Class for Laravel 4 based on FuelPHP's Formatter Class

Changelog Update support for Laravel 6 & phpunit 8 Update composer.json Upgrade to PSR-4 add parameter newline, delimiter, enclosure, and escape to ex

Soapbox Innovations Inc. 249 Nov 29, 2022