marwa-framework

Configuration Contracts

The framework supports optional consumer config files in config/. Missing files are ignored and replaced by code-level defaults defined in src/Config/.

config/app.php

Defined by Marwa\Framework\Config\AppConfig.

Supported keys:

Example:

return [
    'providers' => [
        App\Providers\AppServiceProvider::class,
    ],
    'middlewares' => [
        App\Http\Middleware\TrustProxies::class,
    ],
    'debugbar' => false,
    'useDebugPanel' => false,
    'collectors' => [],
];

config/view.php

Defined by Marwa\Framework\Config\ViewConfig.

Supported keys:

Example:

return [
    'viewsPath' => resources_path('views'),
    'cachePath' => storage_path('cache/views'),
    'debug' => false,
    'themePath' => resources_path('views/themes'),
    'activeTheme' => 'default',
    'fallbackTheme' => 'default',
];

config/event.php

Defined by Marwa\Framework\Config\EventConfig.

Supported keys:

Example:

return [
    'listeners' => [
        Marwa\Framework\Adapters\Event\AppBooted::class => [
            [App\Listeners\LogApplicationBoot::class, 'handle'],
        ],
        Marwa\Framework\Adapters\Event\RequestHandled::class => [
            [App\Listeners\LogRequestHandled::class, 'handle'],
        ],
    ],
    'subscribers' => [
        App\Listeners\RuntimeSubscriber::class,
    ],
];

Lifecycle events available out of the box:

config/logger.php

Defined by Marwa\Framework\Config\LoggerConfig.

Supported keys:

config/mail.php

Defined by Marwa\Framework\Config\MailConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'driver' => 'smtp',
    'charset' => 'UTF-8',
    'from' => [
        'address' => 'no-reply@example.com',
        'name' => 'MarwaPHP',
    ],
    'smtp' => [
        'host' => '127.0.0.1',
        'port' => 1025,
        'encryption' => null,
        'username' => null,
        'password' => null,
        'authMode' => null,
        'timeout' => 30,
    ],
    'sendmail' => [
        'path' => '/usr/sbin/sendmail -bs',
    ],
];

config/http.php

Defined by Marwa\Framework\Config\HttpConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'default' => 'github',
    'clients' => [
        'github' => [
            'base_uri' => 'https://api.github.com',
            'timeout' => 15,
            'connect_timeout' => 5,
            'http_errors' => false,
            'verify' => true,
            'headers' => [
                'Accept' => 'application/vnd.github+json',
            ],
        ],
    ],
];

config/notification.php

Defined by Marwa\Framework\Config\NotificationConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'default' => ['mail', 'database'],
    'channels' => [
        'http' => [
            'enabled' => true,
            'url' => 'https://hooks.example.test/notify',
        ],
        'kafka' => [
            'enabled' => true,
            'publisher' => App\Kafka\MarwaKafkaPublisher::class,
            'consumer' => App\Kafka\MarwaKafkaConsumer::class,
            'topic' => 'notifications',
            'topics' => ['notifications'],
            'groupId' => 'app',
        ],
        'sms' => [
            'enabled' => true,
            'url' => 'https://sms.example.test/send',
        ],
    ],
];

config/cache.php

Defined by Marwa\Framework\Config\CacheConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'driver' => 'sqlite',
    'namespace' => 'app',
    'buffered' => true,
    'transactional' => false,
    'stampede' => [
        'enabled' => true,
        'sla' => 1000,
    ],
    'sqlite' => [
        'path' => storage_path('cache/framework.sqlite'),
        'table' => 'framework_cache',
    ],
];

config/error.php

Defined by Marwa\Framework\Config\ErrorConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'appName' => 'My App',
    'environment' => env('APP_ENV', 'production'),
    'useLogger' => true,
    'useDebugReporter' => true,
    'renderer' => Marwa\ErrorHandler\Support\FallbackRenderer::class,
];

config/security.php

Defined by Marwa\Framework\Config\SecurityConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'csrf' => [
        'enabled' => true,
        'except' => ['webhook/*'],
    ],
    'trustedHosts' => ['example.com'],
    'trustedOrigins' => ['https://example.com'],
    'throttle' => [
        'enabled' => true,
        'prefix' => 'security',
        'limit' => 60,
        'window' => 60,
    ],
    'risk' => [
        'enabled' => true,
        'logPath' => storage_path('security/risk.jsonl'),
        'pruneAfterDays' => 30,
        'topCount' => 10,
    ],
];

config/database.php

Defined by Marwa\Framework\Config\DatabaseConfig.

Supported keys:

The debug panel toggle lives in config/app.php as useDebugPanel.

Example:

return [
    'enabled' => true,
    'default' => 'sqlite',
    'connections' => [
        'sqlite' => [
            'driver' => 'sqlite',
            'database' => base_path('database/database.sqlite'),
            'debug' => false,
        ],
    ],
    'migrationsPath' => base_path('database/migrations'),
    'seedersPath' => base_path('database/seeders'),
    'seedersNamespace' => 'Database\\Seeders',
];

config/bootstrap.php

Defined by Marwa\Framework\Config\BootstrapConfig.

Supported keys:

Default paths:

config/session.php

Defined by Marwa\Framework\Config\SessionConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'autoStart' => false,
    'name' => 'marwa_session',
    'lifetime' => 7200,
    'path' => '/',
    'domain' => '',
    'secure' => env('APP_ENV') === 'production',
    'httpOnly' => true,
    'sameSite' => 'Lax',
    'encrypt' => true,
];

Encrypted sessions require APP_KEY to be configured.

The session service also supports flash data through flash(), now(), reflash(), and keep().

config/schedule.php

Defined by Marwa\Framework\Config\ScheduleConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'driver' => 'cache',
    'file' => [
        'path' => storage_path('framework/schedule'),
    ],
    'cache' => [
        'namespace' => 'schedule',
    ],
    'database' => [
        'connection' => 'sqlite',
        'table' => 'schedule_jobs',
    ],
    'defaultLoopSeconds' => 60,
    'defaultSleepSeconds' => 1,
];

Use php marwa schedule:table to create a migration stub for the configured scheduler table when the database driver is enabled.

config/storage.php

Defined by Marwa\Framework\Config\StorageConfig.

Supported keys:

Example:

return [
    'default' => 'local',
    'disks' => [
        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
            'visibility' => 'private',
        ],
        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'visibility' => 'public',
        ],
    ],
];

config/module.php

Defined by Marwa\Framework\Config\ModuleConfig.

Supported keys:

config/queue.php

Defined by Marwa\Framework\Config\QueueConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'default' => 'default',
    'path' => storage_path('queue'),
    'retryAfter' => 90,
];

config/schedule.php

Defined by Marwa\Framework\Config\ScheduleConfig.

Supported keys:

Example:

return [
    'enabled' => true,
    'lockPath' => storage_path('framework/schedule'),
    'defaultLoopSeconds' => 60,
    'defaultSleepSeconds' => 1,
];

Example:

return [
    'enabled' => true,
    'paths' => [
        base_path('modules'),
    ],
    'cache' => base_path('bootstrap/cache/modules.php'),
    'forceRefresh' => false,
    'commandPaths' => ['commands'],
    'commandConventions' => ['Console/Commands', 'src/Console/Commands'],
];