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.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
- 🔒 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
- Composer PHP package manager [https://getcomposer.org]
- PHP 7.4 or higher
- MySQL/MariaDB database
1)Install Composer PHP package manager [https://getcomposer.org]
- Clone this Repository in CLI by running:
git clone https://github.com/aoamusat/fortress.git- Navigate to the project directory:
cd fortress- Install dependencies:
composer install- Configure your database in
config.php:
'database' => [
'name' => 'your_database_name',
'host' => 'localhost',
'username' => 'your_username',
'password' => 'your_password',
]- Start the development server:
php fortress runOr visit via traditional web server:
http://localhost/fortress
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
- Parameterized queries with PDO
- Input sanitization and validation
- Secure database connection handling
// Configure in routes.php
$router->middleware(new RateLimitMiddleware(100, 60)) // 100 requests/minute
->middleware(new ThrottleMiddleware(1)); // 1 second between requests// Interface binding
App::bind(UserRepositoryInterface::class, UserRepository::class);
// Singleton registration
App::singleton(DatabaseManager::class);
// Auto-resolution
$service = App::resolve(SomeService::class);Fortress includes a Laravel Artisan-like CLI system for development tasks:
# 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 --helprun- Start the development server with built-in PHP server
Create new commands by implementing CommandInterface:
<?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.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- ✅ Added Laravel Artisan-like CLI system
- ✅ Implemented development server command
- ✅ Enhanced developer experience with command-line tools
- ✅ 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
- Basic MVC structure
- Simple routing system
- Basic database connection
This project is licensed under the MIT License - see the LICENSE.md file for details