Set up modern PHP MVC project structure for GetYourBand platform
- Implemented clean MVC architecture with Router, Controller, and Model base classes - Created database migrations for users, bands, bookings, reviews, and availability - Set up Tailwind CSS with yellow color scheme and modern design - Added Alpine.js for reactive JavaScript components - Configured Vite for asset building and hot module replacement - Created authentication and role-based middleware - Implemented helper functions and configuration system - Added comprehensive README with setup instructions - Configured Apache with proper rewrite rules and security headers - Set up Composer and npm package management with modern dependencies
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
// Start session
|
||||
session_start();
|
||||
|
||||
// Load Composer autoloader
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
// Load environment variables
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->load();
|
||||
|
||||
// Set timezone
|
||||
date_default_timezone_set('Europe/Zurich');
|
||||
|
||||
// Error reporting based on environment
|
||||
if (env('APP_DEBUG', false)) {
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
} else {
|
||||
error_reporting(0);
|
||||
ini_set('display_errors', 0);
|
||||
}
|
||||
|
||||
// Load configuration
|
||||
$config = [];
|
||||
$configFiles = glob(__DIR__ . '/config/*.php');
|
||||
foreach ($configFiles as $file) {
|
||||
$key = basename($file, '.php');
|
||||
$config[$key] = require $file;
|
||||
}
|
||||
|
||||
// Make config globally accessible
|
||||
define('CONFIG', $config);
|
||||
|
||||
// Helper function to access config
|
||||
function config(string $key, $default = null)
|
||||
{
|
||||
$keys = explode('.', $key);
|
||||
$value = CONFIG;
|
||||
|
||||
foreach ($keys as $k) {
|
||||
if (!isset($value[$k])) {
|
||||
return $default;
|
||||
}
|
||||
$value = $value[$k];
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
Reference in New Issue
Block a user