add composer-unused, comprehensive docs, and project restructure
- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks - Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists - Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services - Add Microsoft OIDC SSO, API token management, and user lifecycle features - Add swagger-ui vendor integration and OpenAPI spec - Add production Docker setup and bin/ scripts - Update composer dependencies, config, templates, and frontend assets throughout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
69
config/assets.php
Normal file
69
config/assets.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'styles' => [
|
||||
'groups' => [
|
||||
'base' => [
|
||||
'css/app-layers.css',
|
||||
'css/base/variables.base.css',
|
||||
'css/base/variables.theme-dark-green.css',
|
||||
'css/base/variables.contrast.css',
|
||||
],
|
||||
'shared' => [
|
||||
'css/components/app-badges.css',
|
||||
'css/layout/app-shell.css',
|
||||
'css/components/app-blockquote.css',
|
||||
'css/components/app-forms.css',
|
||||
'css/components/app-flash.css',
|
||||
'css/components/app-brand.css',
|
||||
],
|
||||
'default' => [
|
||||
'css/vendor-overrides/multi-select.css',
|
||||
'css/components/app-buttons.css',
|
||||
'css/vendor-overrides/gridjs.css',
|
||||
'css/layout/app-topbar.css',
|
||||
'css/layout/app-sidebar.css',
|
||||
'css/components/app-search.css',
|
||||
'css/components/app-list-titlebar.css',
|
||||
'css/components/app-details-titlebar.css',
|
||||
'css/components/app-dashboard-titlebar.css',
|
||||
'css/components/app-details.css',
|
||||
'css/components/app-list-table.css',
|
||||
'css/components/app-list-tabs.css',
|
||||
'css/components/app-tabs.css',
|
||||
'css/components/app-list-toolbar.css',
|
||||
'css/components/app-breadcrumb.css',
|
||||
'css/components/app-tile.css',
|
||||
'css/components/app-tooltips.css',
|
||||
'css/components/app-page-editor.css',
|
||||
'css/vendor-overrides/editorjs.css',
|
||||
'css/components/app-page-copy.css',
|
||||
'css/layout/app-aside-icon-bar.css',
|
||||
],
|
||||
'login' => [
|
||||
'css/pages/app-login.css',
|
||||
],
|
||||
'address-book' => [
|
||||
'css/pages/address-book-view.css',
|
||||
],
|
||||
'error' => [
|
||||
'css/pages/app-error.css',
|
||||
],
|
||||
'page-layout' => [
|
||||
'css/layout/app-page-layout.css',
|
||||
],
|
||||
'api-docs' => [
|
||||
'css/vendor-overrides/swagger-ui.css',
|
||||
],
|
||||
'docs' => [
|
||||
'css/pages/app-docs.css',
|
||||
],
|
||||
],
|
||||
'templates' => [
|
||||
'default' => ['base', 'shared', 'default'],
|
||||
'login' => ['base', 'shared', 'login'],
|
||||
'error' => ['base', 'error'],
|
||||
'page' => ['base', 'shared', 'page-layout'],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -9,52 +9,104 @@ use MintyPHP\I18n;
|
||||
use MintyPHP\Router;
|
||||
use MintyPHP\Session;
|
||||
|
||||
define('APP_NAME', getenv('APP_NAME') ?: 'IMVS');
|
||||
define('APP_SLOGAN', getenv('APP_SLOGAN') ?: 'Immobilien Makler Verkaufs Software');
|
||||
define('APP_TIMEZONE', getenv('APP_TIMEZONE') ?: 'Europe/Berlin');
|
||||
define('APP_STORAGE_PATH', getenv('APP_STORAGE_PATH') ?: __DIR__ . '/../storage');
|
||||
$tenantScopeEnv = getenv('TENANT_SCOPE_STRICT');
|
||||
define('TENANT_SCOPE_STRICT', $tenantScopeEnv === false ? true : filter_var($tenantScopeEnv, FILTER_VALIDATE_BOOLEAN));
|
||||
$envString = static function (string $key, string $default): string {
|
||||
$value = getenv($key);
|
||||
if ($value === false || $value === '') {
|
||||
return $default;
|
||||
}
|
||||
return (string) $value;
|
||||
};
|
||||
|
||||
$envInt = static function (string $key, int $default): int {
|
||||
$value = getenv($key);
|
||||
if ($value === false || $value === '') {
|
||||
return $default;
|
||||
}
|
||||
$parsed = filter_var($value, FILTER_VALIDATE_INT);
|
||||
return $parsed !== false ? (int) $parsed : $default;
|
||||
};
|
||||
|
||||
$envFloat = static function (string $key, float $default): float {
|
||||
$value = getenv($key);
|
||||
if ($value === false || $value === '') {
|
||||
return $default;
|
||||
}
|
||||
$parsed = filter_var($value, FILTER_VALIDATE_FLOAT);
|
||||
return $parsed !== false ? (float) $parsed : $default;
|
||||
};
|
||||
|
||||
$envBool = static function (string $key, bool $default): bool {
|
||||
$value = getenv($key);
|
||||
if ($value === false || $value === '') {
|
||||
return $default;
|
||||
}
|
||||
$parsed = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
|
||||
return $parsed ?? $default;
|
||||
};
|
||||
|
||||
$envList = static function (string $key, array $default): array {
|
||||
$value = getenv($key);
|
||||
if ($value === false || $value === '') {
|
||||
return $default;
|
||||
}
|
||||
return array_values(array_filter(array_map('trim', explode(',', (string) $value))));
|
||||
};
|
||||
|
||||
define('APP_NAME', $envString('APP_NAME', 'IMVS'));
|
||||
define('APP_TIMEZONE', $envString('APP_TIMEZONE', 'Europe/Berlin'));
|
||||
define('APP_STORAGE_PATH', $envString('APP_STORAGE_PATH', __DIR__ . '/../storage'));
|
||||
define('APP_CRYPTO_KEY', $envString('APP_CRYPTO_KEY', ''));
|
||||
define('TENANT_SCOPE_STRICT', $envBool('TENANT_SCOPE_STRICT', true));
|
||||
if (!defined('APP_LOCALES')) {
|
||||
$locales = getenv('APP_LOCALES') ?: 'de,en';
|
||||
define('APP_LOCALES', array_values(array_filter(array_map('trim', explode(',', $locales)))));
|
||||
define('APP_LOCALES', $envList('APP_LOCALES', ['de', 'en']));
|
||||
}
|
||||
|
||||
if (!defined('APP_ROUTE_DEFINITIONS')) {
|
||||
$routesFile = __DIR__ . '/routes.php';
|
||||
$routeDefinitions = is_file($routesFile) ? include $routesFile : [];
|
||||
if (!is_array($routeDefinitions)) {
|
||||
$routeDefinitions = [];
|
||||
}
|
||||
define('APP_ROUTE_DEFINITIONS', $routeDefinitions);
|
||||
}
|
||||
|
||||
if (!defined('APP_PUBLIC_PATHS')) {
|
||||
define('APP_PUBLIC_PATHS', [
|
||||
'login',
|
||||
'register',
|
||||
'password/forgot',
|
||||
'password/verify',
|
||||
'password/reset',
|
||||
'lang',
|
||||
'imprint',
|
||||
'privacy',
|
||||
]);
|
||||
$publicPaths = [];
|
||||
foreach (APP_ROUTE_DEFINITIONS as $route) {
|
||||
if (!empty($route['public'])) {
|
||||
$path = trim((string) ($route['path'] ?? ''));
|
||||
if ($path !== '') {
|
||||
$publicPaths[] = $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$publicPaths) {
|
||||
throw new RuntimeException('No public routes configured in config/routes.php');
|
||||
}
|
||||
define('APP_PUBLIC_PATHS', array_values(array_unique($publicPaths)));
|
||||
}
|
||||
|
||||
date_default_timezone_set(APP_TIMEZONE);
|
||||
ini_set('date.timezone', APP_TIMEZONE);
|
||||
|
||||
Router::$baseUrl = '/'; // default: '/'
|
||||
Router::$pageRoot = 'pages/'; // default: 'pages/'
|
||||
Router::$templateRoot = 'templates/'; // default: 'templates/'
|
||||
|
||||
Session::$sessionName = getenv('SESSION_NAME') ?: 'MintyPHP';
|
||||
Session::$sessionName = $envString('SESSION_NAME', 'MintyPHP');
|
||||
|
||||
Firewall::$concurrency = (int) (getenv('FIREWALL_CONCURRENCY') ?: 10);
|
||||
Firewall::$spinLockSeconds = (float) (getenv('FIREWALL_SPINLOCK_SECONDS') ?: 0.15);
|
||||
Firewall::$intervalSeconds = (int) (getenv('FIREWALL_INTERVAL_SECONDS') ?: 300);
|
||||
Firewall::$cachePrefix = getenv('FIREWALL_CACHE_PREFIX') ?: 'fw_concurrency_';
|
||||
Firewall::$reverseProxy = getenv('FIREWALL_REVERSE_PROXY') === 'true';
|
||||
Firewall::$concurrency = $envInt('FIREWALL_CONCURRENCY', 10);
|
||||
Firewall::$spinLockSeconds = $envFloat('FIREWALL_SPINLOCK_SECONDS', 0.15);
|
||||
Firewall::$intervalSeconds = $envInt('FIREWALL_INTERVAL_SECONDS', 300);
|
||||
Firewall::$cachePrefix = $envString('FIREWALL_CACHE_PREFIX', 'fw_concurrency_');
|
||||
Firewall::$reverseProxy = $envBool('FIREWALL_REVERSE_PROXY', false);
|
||||
|
||||
Cache::$servers = getenv('CACHE_SERVERS') ?: '127.0.0.1';
|
||||
Cache::$servers = $envString('CACHE_SERVERS', '127.0.0.1');
|
||||
|
||||
DB::$host = getenv('DB_HOST') ?: 'db';
|
||||
DB::$username = getenv('DB_USER') ?: 'mintyphp';
|
||||
DB::$password = getenv('DB_PASS') ?: 'mintyphp';
|
||||
DB::$database = getenv('DB_NAME') ?: 'mintyphp';
|
||||
DB::$port = (int) (getenv('DB_PORT') ?: 3306);
|
||||
DB::$host = $envString('DB_HOST', 'db');
|
||||
DB::$username = $envString('DB_USER', 'mintyphp');
|
||||
DB::$password = $envString('DB_PASS', 'mintyphp');
|
||||
DB::$database = $envString('DB_NAME', 'mintyphp');
|
||||
DB::$port = $envInt('DB_PORT', 3306);
|
||||
|
||||
Auth::$usersTable = 'users';
|
||||
Auth::$usernameField = 'email';
|
||||
@@ -62,8 +114,7 @@ Auth::$passwordField = 'password';
|
||||
Auth::$createdField = 'created';
|
||||
Auth::$totpSecretField = 'totp_secret';
|
||||
|
||||
$debugEnv = getenv('APP_DEBUG');
|
||||
Debugger::$enabled = $debugEnv === false ? true : filter_var($debugEnv, FILTER_VALIDATE_BOOLEAN);
|
||||
Debugger::$enabled = $envBool('APP_DEBUG', true);
|
||||
|
||||
I18n::$domain = getenv('APP_I18N_DOMAIN') ?: 'default';
|
||||
I18n::$locale = getenv('APP_LOCALE') ?: 'de';
|
||||
I18n::$domain = $envString('APP_I18N_DOMAIN', 'default');
|
||||
I18n::$locale = $envString('APP_LOCALE', 'de');
|
||||
|
||||
@@ -2,15 +2,18 @@
|
||||
|
||||
use MintyPHP\Router;
|
||||
|
||||
// Set up redirects
|
||||
$routesFile = __DIR__ . '/routes.php';
|
||||
$routeDefinitions = defined('APP_ROUTE_DEFINITIONS') ? APP_ROUTE_DEFINITIONS : [];
|
||||
if (!is_array($routeDefinitions) || !$routeDefinitions) {
|
||||
$routeDefinitions = is_file($routesFile) ? include $routesFile : [];
|
||||
}
|
||||
|
||||
Router::addRoute('login', 'auth/login');
|
||||
Router::addRoute('register', 'auth/register');
|
||||
Router::addRoute('logout', 'auth/logout');
|
||||
Router::addRoute('profile', 'account/profile');
|
||||
Router::addRoute('password/forgot', 'auth/forgot');
|
||||
Router::addRoute('password/verify', 'auth/verify');
|
||||
Router::addRoute('password/reset', 'auth/reset');
|
||||
Router::addRoute('verify-email', 'auth/verify-email');
|
||||
Router::addRoute('imprint', 'page/imprint');
|
||||
Router::addRoute('privacy', 'page/privacy');
|
||||
if (is_array($routeDefinitions)) {
|
||||
foreach ($routeDefinitions as $route) {
|
||||
$path = trim((string) ($route['path'] ?? ''));
|
||||
$target = trim((string) ($route['target'] ?? ''));
|
||||
if ($path !== '' && $target !== '') {
|
||||
Router::addRoute($path, $target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
14
config/routes.php
Normal file
14
config/routes.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
return [
|
||||
['path' => 'login', 'target' => 'auth/login', 'public' => true],
|
||||
['path' => 'register', 'target' => 'auth/register', 'public' => true],
|
||||
['path' => 'logout', 'target' => 'auth/logout', 'public' => false],
|
||||
['path' => 'profile', 'target' => 'account/profile', 'public' => false],
|
||||
['path' => 'password/forgot', 'target' => 'auth/forgot', 'public' => true],
|
||||
['path' => 'password/verify', 'target' => 'auth/verify', 'public' => true],
|
||||
['path' => 'password/reset', 'target' => 'auth/reset', 'public' => true],
|
||||
['path' => 'verify-email', 'target' => 'auth/verify-email', 'public' => true],
|
||||
['path' => 'lang', 'target' => 'lang', 'public' => true],
|
||||
['path' => 'imprint', 'target' => 'page/imprint', 'public' => true],
|
||||
['path' => 'privacy', 'target' => 'page/privacy', 'public' => true],
|
||||
];
|
||||
@@ -1,9 +1,13 @@
|
||||
<?php
|
||||
return array (
|
||||
'app_title' => 'IVMS',
|
||||
'app_locale' => 'de',
|
||||
'app_theme' => 'dark',
|
||||
'app_theme_user' => '1',
|
||||
'app_registration' => '1',
|
||||
'app_primary_color' => '#105433',
|
||||
);
|
||||
return [
|
||||
'app_title' => 'Malphite',
|
||||
'app_locale' => 'de',
|
||||
'app_theme' => 'light',
|
||||
'app_theme_user' => '1',
|
||||
'app_registration' => '1',
|
||||
'app_primary_color' => '#105433',
|
||||
'api_token_default_ttl_days' => '90',
|
||||
'api_token_max_ttl_days' => '365',
|
||||
'api_cors_allowed_origins' => 'http://localhost:8080
|
||||
http://127.0.0.1:8080',
|
||||
];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'light' => 'Light',
|
||||
'dark' => 'Dark',
|
||||
|
||||
Reference in New Issue
Block a user