2017 © Pedro Pelรกez
 

project mvc-boilerplate

A simple PHP MVC Boilerplate

image

haykay/mvc-boilerplate

A simple PHP MVC Boilerplate

  • Thursday, October 19, 2017
  • by dev_haykay
  • Repository
  • 1 Watchers
  • 3 Stars
  • 1 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Fortress

A secure, enterprise-grade MVC framework in PHP with built-in security features, middleware pipeline, and advanced dependency injection. Perfect for teaching modern PHP development patterns and building production-ready micro PHP applications., (*1)

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes., (*2)

Features

  • ๐Ÿ”’ Built-in Security: SQL injection protection, input sanitization, and secure query building
  • ๐Ÿ›ก๏ธ Middleware Pipeline: Rate limiting, request throttling, and extensible middleware system
  • ๐Ÿ—๏ธ Advanced DI Container: Interface binding, auto-resolution, and singleton management
  • โšก Performance: Optimized routing with middleware caching and efficient request handling
  • ๐ŸŽฏ Clean Architecture: Separation of concerns with proper exception handling
  • ๐Ÿ› ๏ธ CLI Tools: Laravel Artisan-like command line interface for development
  • ๐Ÿ“š Educational: Perfect for learning modern PHP development patterns

Prerequisites

  1. Composer PHP package manager [https://getcomposer.org]
  2. PHP 7.4 or higher
  3. MySQL/MariaDB database

Installation

1)Install Composer PHP package manager [https://getcomposer.org], (*3)

2) Clone this Repository in CLI by running:, (*4)

git clone https://github.com/aoamusat/fortress.git

3) Navigate to the project directory:, (*5)

cd fortress

4) Install dependencies:, (*6)

composer install

5) Configure your database in config.php:, (*7)

'database' => [
    'name' => 'your_database_name',
    'host' => 'localhost',
    'username' => 'your_username',
    'password' => 'your_password',
]

6) Start the development server:, (*8)

php fortress run

Or visit via traditional web server:, (*9)

http://localhost/fortress

Architecture

fortress follows a clean MVC architecture with additional security layers:, (*10)

app/
โ”œโ”€โ”€ controllers/        # Request handlers
โ”œโ”€โ”€ core/              # Framework core
โ”‚   โ”œโ”€โ”€ console/       # CLI command system
โ”‚   โ”œโ”€โ”€ exceptions/    # Custom exception classes
โ”‚   โ”œโ”€โ”€ interfaces/    # Contracts and interfaces
โ”‚   โ”œโ”€โ”€ middleware/    # Security and request middleware
โ”‚   โ””โ”€โ”€ database/      # Database layer with security
โ”œโ”€โ”€ views/             # Presentation layer
โ””โ”€โ”€ bootstrap/         # Application bootstrap files

Security Features

๐Ÿ”’ SQL Injection Protection

  • Parameterized queries with PDO
  • Input sanitization and validation
  • Secure database connection handling

๐Ÿ›ก๏ธ Rate Limiting & Throttling

// Configure in routes.php
$router->middleware(new RateLimitMiddleware(100, 60))  // 100 requests/minute
       ->middleware(new ThrottleMiddleware(1));         // 1 second between requests

๐Ÿ—๏ธ Dependency Injection

// Interface binding
App::bind(UserRepositoryInterface::class, UserRepository::class);

// Singleton registration
App::singleton(DatabaseManager::class);

// Auto-resolution
$service = App::resolve(SomeService::class);

CLI Commands

Fortress includes a Laravel Artisan-like CLI system for development tasks:, (*11)

Development Server

# Start server (default: localhost:8000)
php fortress run

# Custom host and port
php fortress run 127.0.0.1:3000
php fortress run --host=0.0.0.0 --port=8080

# Show help
php fortress run --help

Available Commands

  • run - Start the development server with built-in PHP server

Extending the CLI

Create new commands by implementing CommandInterface:, (*12)

<?php
namespace App\Core\Console\Commands;

class MyCommand implements CommandInterface
{
    public function execute(array $arguments)
    {
        // Your command logic here
    }
}

Register commands in app/Core/Console/Console.php., (*13)

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us., (*14)

Changelog

v2.1.0 (Latest)

  • โœ… Added Laravel Artisan-like CLI system
  • โœ… Implemented development server command
  • โœ… Enhanced developer experience with command-line tools

v2.0.0

  • โœ… Fixed critical SQL injection vulnerabilities
  • โœ… Added comprehensive exception handling system
  • โœ… Implemented advanced dependency injection container
  • โœ… Built middleware pipeline with rate limiting
  • โœ… Added request throttling capabilities
  • โœ… Enhanced security throughout the framework

v1.0.0 (Original)

  • Basic MVC structure
  • Simple routing system
  • Basic database connection

License

This project is licensed under the MIT License - see the LICENSE.md file for details, (*15)

The Versions

19/10 2017

dev-master

9999999-dev

A simple PHP MVC Boilerplate

  Sources   Download

MIT

The Requires

  • php >=7.0

 

framework boilerplate mvc

19/10 2017

dev-EDBranch

dev-EDBranch

A simple PHP MVC Boilerplate

  Sources   Download

MIT

The Requires

  • php >=7.0

 

framework boilerplate mvc

02/10 2017

dev-Haykay_Test_Branch

dev-Haykay_Test_Branch

A simple PHP MVC Boilerplate

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

framework boilerplate mvc