add Docsify-based documentation site
Add a complete documentation site for Plugi with the following pages: - Readme.md: project overview, quick start, and key features - GettingStarted.md: installation guide, requirements, and first steps - Configuration.md: full reference for .env and config.php settings - Themes.md: theme structure, blocks, layouts, and asset compilation - Extensions.md: extension architecture, routes, blocks, and admin pages Also add index.html (Docsify entry point), _sidebar.md (navigation), favicon.ico, and .nojekyll to prevent GitHub Pages from interfering.
This commit is contained in:
@@ -0,0 +1,202 @@
|
||||
# Configuration
|
||||
|
||||
Plugi is configured through two files:
|
||||
|
||||
- **`.env`** — Environment variables for database connection and application stage.
|
||||
- **`config.php`** — PHP array that controls all framework behavior, modules, themes, and extensions.
|
||||
|
||||
## The `.env` File
|
||||
|
||||
The `.env` file is loaded by `EnvLoader` at boot time. It must exist in the project root. Typical contents:
|
||||
|
||||
```ini
|
||||
DB_HOST=mysql
|
||||
DB_NAME=plugi
|
||||
DB_USER=plugi
|
||||
DB_PASSWORD=plugi
|
||||
STAGE=development
|
||||
```
|
||||
|
||||
| Variable | Description | Default |
|
||||
|----------------|----------------------------------------------|------------------|
|
||||
| `DB_HOST` | MySQL host (e.g., `localhost` or `mysql`) | `mysql` |
|
||||
| `DB_NAME` | Database name | `plugi` |
|
||||
| `DB_USER` | Database user | `plugi` |
|
||||
| `DB_PASSWORD` | Database password | `plugi` |
|
||||
| `STAGE` | Application stage (`development` or `production`) | `development` |
|
||||
|
||||
Setting `STAGE=production` disables PHP error display in `index.php`.
|
||||
|
||||
## The `config.php` File
|
||||
|
||||
Copy `config.dist.php` to `config.php` and adjust the settings. The configuration is a PHP array with the following sections:
|
||||
|
||||
### General Settings
|
||||
|
||||
```php
|
||||
'general' => [
|
||||
'language' => 'en',
|
||||
'assets_url' => '/plugi-core/dist',
|
||||
'uploads_url' => '/uploads'
|
||||
],
|
||||
```
|
||||
|
||||
| Key | Description |
|
||||
|----------------|--------------------------------------------------|
|
||||
| `language` | Default language code (e.g., `en`, `de`, `fr`). Theme and extension translations are loaded for this language. |
|
||||
| `assets_url` | Public URL path to the Plugi core assets (JS, CSS, images). |
|
||||
| `uploads_url` | Public URL path to the uploads directory. |
|
||||
|
||||
### Storage Settings
|
||||
|
||||
```php
|
||||
'storage' => [
|
||||
'use_database' => true,
|
||||
'uploads_folder' => __DIR__ . '/uploads'
|
||||
],
|
||||
```
|
||||
|
||||
| Key | Description |
|
||||
|--------------------|----------------------------------------------------------|
|
||||
| `use_database` | Set to `true` to use MySQL for storing pages, settings, and uploads metadata. |
|
||||
| `uploads_folder` | Absolute filesystem path where uploaded files are stored. |
|
||||
|
||||
### Auth Settings
|
||||
|
||||
```php
|
||||
'auth' => [
|
||||
'use_login' => true,
|
||||
'class' => Plugi\Modules\Auth\Auth::class,
|
||||
'url' => '/admin/auth',
|
||||
],
|
||||
```
|
||||
|
||||
| Key | Description |
|
||||
|---------------|-----------------------------------------------------------------------------|
|
||||
| `use_login` | Enable or disable the built-in authentication module. |
|
||||
| `class` | Fully qualified class name implementing `AuthContract`. |
|
||||
| `url` | URL prefix for auth endpoints (login/logout). |
|
||||
|
||||
The default `Auth` class checks credentials stored in the database settings table. Change the admin username and password from the admin panel after first login.
|
||||
|
||||
### Website Manager Settings
|
||||
|
||||
```php
|
||||
'website_manager' => [
|
||||
'use_website_manager' => true,
|
||||
'class' => Plugi\Modules\WebsiteManager\WebsiteManager::class,
|
||||
'url' => '/admin'
|
||||
],
|
||||
```
|
||||
|
||||
| Key | Description |
|
||||
|---------------------------|-----------------------------------------------------------------------|
|
||||
| `use_website_manager` | Enable or disable the admin dashboard. |
|
||||
| `class` | Class implementing `WebsiteManagerContract`. |
|
||||
| `url` | URL prefix for the admin panel. |
|
||||
|
||||
### Page Builder Settings
|
||||
|
||||
```php
|
||||
'pagebuilder' => [
|
||||
'class' => Plugi\Modules\GrapesJS\PageBuilder::class,
|
||||
'url' => '/admin/pagebuilder',
|
||||
'actions' => [
|
||||
'back' => '/admin'
|
||||
]
|
||||
],
|
||||
```
|
||||
|
||||
| Key | Description |
|
||||
|-------------|---------------------------------------------------------------|
|
||||
| `class` | Class implementing `PageBuilderContract` (GrapesJS-based by default). |
|
||||
| `url` | URL prefix for the page builder. |
|
||||
| `actions` | Named action URLs, e.g., `back` returns to the admin panel. |
|
||||
|
||||
### Page Settings
|
||||
|
||||
```php
|
||||
'page' => [
|
||||
'class' => Plugi\Page::class,
|
||||
'table' => 'pages',
|
||||
'translation' => [
|
||||
'class' => Plugi\PageTranslation::class,
|
||||
'table' => 'page_translations',
|
||||
'foreign_key' => 'page_id',
|
||||
]
|
||||
],
|
||||
```
|
||||
|
||||
| Key | Description |
|
||||
|-----------------------|---------------------------------------------------------------|
|
||||
| `class` | Class implementing `PageContract`. |
|
||||
| `table` | Database table name for pages. |
|
||||
| `translation.class` | Class implementing `PageTranslationContract`. |
|
||||
| `translation.table` | Database table name for page translations (multilingual support). |
|
||||
| `translation.foreign_key` | Foreign key column linking translations to pages. |
|
||||
|
||||
### Cache Settings
|
||||
|
||||
```php
|
||||
'cache' => [
|
||||
'enabled' => false,
|
||||
'folder' => __DIR__ . '/cache',
|
||||
'class' => Plugi\Cache::class
|
||||
],
|
||||
```
|
||||
|
||||
| Key | Description |
|
||||
|-------------|-----------------------------------------------------------------------------|
|
||||
| `enabled` | Enable page caching. Cached pages skip block parsing on subsequent requests. |
|
||||
| `folder` | Filesystem path for cache files. |
|
||||
| `class` | Class implementing `CacheContract`. |
|
||||
|
||||
A page is cached unless it contains a block with caching disabled. The cache is automatically cleared when a page is saved in the page builder. You can also force a cache refresh by appending `?refresh_cache` to the URL.
|
||||
|
||||
### Theme Settings
|
||||
|
||||
```php
|
||||
'theme' => [
|
||||
'class' => Plugi\Theme::class,
|
||||
'folder' => __DIR__ . '/themes',
|
||||
'folder_url' => '/themes',
|
||||
'active_theme' => 'theme-one'
|
||||
],
|
||||
```
|
||||
|
||||
| Key | Description |
|
||||
|------------------|---------------------------------------------------------------|
|
||||
| `class` | Class implementing `ThemeContract`. |
|
||||
| `folder` | Filesystem path to the themes directory. |
|
||||
| `folder_url` | Public URL path to the themes directory. |
|
||||
| `active_theme` | Slug of the active theme (matches a folder name in `themes/`). |
|
||||
|
||||
### Router Settings
|
||||
|
||||
```php
|
||||
'router' => [
|
||||
'class' => Plugi\Modules\Router\DatabasePageRouter::class
|
||||
],
|
||||
```
|
||||
|
||||
| Key | Description |
|
||||
|-----------|---------------------------------------------------------------|
|
||||
| `class` | Class implementing `RouterContract` that resolves URLs to pages. |
|
||||
|
||||
### Class Replacements
|
||||
|
||||
```php
|
||||
'class_replacements' => [
|
||||
// Plugi\UploadedFile::class => Alternative\UploadedFile::class
|
||||
],
|
||||
```
|
||||
|
||||
Map a core class namespace to an alternative implementation. This allows overriding specific classes while extending the originals. Example:
|
||||
|
||||
```php
|
||||
'class_replacements' => [
|
||||
Plugi\UploadedFile::class => My\App\CustomUploadedFile::class,
|
||||
],
|
||||
```
|
||||
|
||||
> **Important:** When overriding a class, always extend the original class.
|
||||
Reference in New Issue
Block a user