Wallogit.com
2017 © Pedro Pelรกez
A simple PHP MVC Boilerplate
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)
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes., (*2)
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
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
// 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:, (*11)
# 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
run - Start the development server with built-in PHP serverCreate 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)
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us., (*14)
This project is licensed under the MIT License - see the LICENSE.md file for details, (*15)