PHPackages                             haykay/mvc-boilerplate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. haykay/mvc-boilerplate

ActiveProject[Framework](/categories/framework)

haykay/mvc-boilerplate
======================

A secure, enterprise-grade MVC framework in PHP

v2.1.0(11mo ago)898MITPHPPHP &gt;=7.4

Since Oct 2Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/dev-haykay/MVCBoilerplate)[ Packagist](https://packagist.org/packages/haykay/mvc-boilerplate)[ RSS](/packages/haykay-mvc-boilerplate/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (1)Versions (6)Used By (0)

Fortress
========

[](#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.

Getting Started
---------------

[](#getting-started)

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

Features
--------

[](#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

[](#prerequisites)

1. Composer PHP package manager \[\]
2. PHP 7.4 or higher
3. MySQL/MariaDB database

### Installation

[](#installation)

1)Install Composer PHP package manager \[\]

2. Clone this Repository in CLI by running:

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

3. Navigate to the project directory:

```
cd fortress
```

4. Install dependencies:

```
composer install
```

5. Configure your database in `config.php`:

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

6. Start the development server:

```
php fortress run
```

Or visit via traditional web server:

```
http://localhost/fortress

```

Architecture
------------

[](#architecture)

fortress follows a clean MVC architecture with additional security layers:

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

[](#security-features)

### 🔒 SQL Injection Protection

[](#-sql-injection-protection)

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

### 🛡️ Rate Limiting &amp; Throttling

[](#️-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

[](#️-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
------------

[](#cli-commands)

Fortress includes a Laravel Artisan-like CLI system for development tasks:

### Development Server

[](#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

[](#available-commands)

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

### Extending the CLI

[](#extending-the-cli)

Create new commands by implementing `CommandInterface`:

```
