Skip to content

Commit f8e5bd4

Browse files
committed
docs: add comprehensive configuration documentation and standardize README
- Add complete CONFIGURATION.md with all settings documented - Include multi-environment examples and performance recommendations - Rename LICENSE.md to LICENSE for GitHub standard - Standardize README config section to match Smart Links format - Add reference to Configuration Documentation
1 parent 7733e93 commit f8e5bd4

File tree

3 files changed

+168
-2
lines changed

3 files changed

+168
-2
lines changed
File renamed without changes.

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ Settings can be configured in the Control Panel at Settings → Icon Manager, or
6767
3. **Display Settings**: Set default display options
6868
4. **Icon Types**: Enable/disable different icon set types
6969

70-
### Config File Overrides
70+
### Config File
7171

72-
You can override settings in `config/icon-manager.php`:
72+
Create a `config/icon-manager.php` file to override default settings:
7373

7474
```php
7575
<?php
@@ -144,6 +144,8 @@ return [
144144

145145
Settings defined in the config file will override CP settings and show a warning message in the settings UI.
146146

147+
See [Configuration Documentation](docs/CONFIGURATION.md) for all available options.
148+
147149
#### Available Configuration Options
148150

149151
- **pluginName** - Customize the plugin display name in navigation and settings

docs/CONFIGURATION.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Icon Manager Configuration
2+
3+
## Configuration File
4+
5+
You can override plugin settings by creating an `icon-manager.php` file in your `config/` directory.
6+
7+
### Basic Setup
8+
9+
1. Copy `vendor/lindemannrock/icon-manager/src/config.php` to `config/icon-manager.php`
10+
2. Modify the settings as needed
11+
12+
### Available Settings
13+
14+
```php
15+
<?php
16+
return [
17+
// Plugin settings
18+
'pluginName' => 'Icon Manager',
19+
20+
// Icon sets path
21+
'iconSetsPath' => '@root/src/icons',
22+
23+
// Caching settings
24+
'enableCache' => true,
25+
'cacheDuration' => 86400, // 24 hours in seconds
26+
27+
// Icon types to enable
28+
'enabledIconTypes' => [
29+
'svg-folder' => true,
30+
'svg-sprite' => true,
31+
'font-awesome' => false,
32+
'material-icons' => false,
33+
],
34+
];
35+
```
36+
37+
### Multi-Environment Configuration
38+
39+
You can have different settings per environment:
40+
41+
```php
42+
<?php
43+
use craft\helpers\App;
44+
45+
return [
46+
// Global settings
47+
'*' => [
48+
'pluginName' => 'Icon Manager',
49+
'iconSetsPath' => '@root/src/icons',
50+
'enabledIconTypes' => [
51+
'svg-folder' => true,
52+
'svg-sprite' => true,
53+
'font-awesome' => false,
54+
'material-icons' => false,
55+
],
56+
],
57+
58+
// Development environment
59+
'dev' => [
60+
'iconSetsPath' => '@root/src/icons',
61+
'enableCache' => true,
62+
'cacheDuration' => 3600, // 1 hour
63+
'enabledIconTypes' => [
64+
'svg-folder' => true,
65+
'svg-sprite' => true,
66+
'font-awesome' => true,
67+
'material-icons' => true,
68+
],
69+
],
70+
71+
// Staging environment
72+
'staging' => [
73+
'iconSetsPath' => '@webroot/dist/assets/icons',
74+
'enableCache' => true,
75+
'cacheDuration' => 86400, // 1 day
76+
],
77+
78+
// Production environment
79+
'production' => [
80+
'iconSetsPath' => '@webroot/dist/assets/icons',
81+
'enableCache' => true,
82+
'cacheDuration' => 2592000, // 30 days
83+
'enabledIconTypes' => [
84+
'svg-folder' => true,
85+
'svg-sprite' => false, // Beta
86+
'font-awesome' => false, // Beta
87+
'material-icons' => false, // Beta
88+
],
89+
],
90+
];
91+
```
92+
93+
### Using Environment Variables
94+
95+
All settings support environment variables:
96+
97+
```php
98+
return [
99+
'enableCache' => getenv('ICON_MANAGER_CACHE') === 'true',
100+
'cacheDuration' => (int)getenv('ICON_CACHE_DURATION') ?: 86400,
101+
'iconSetsPath' => getenv('ICON_SETS_PATH') ?: '@root/icons',
102+
];
103+
```
104+
105+
### Setting Descriptions
106+
107+
#### Plugin Settings
108+
109+
- **pluginName**: Display name for the plugin in Craft CP navigation
110+
111+
#### Icon Storage Settings
112+
113+
- **iconSetsPath**: Path to your icon files (supports Craft aliases like `@root`, `@webroot`)
114+
115+
#### Caching Settings
116+
117+
- **enableCache**: Enable/disable icon data caching for better performance
118+
- **cacheDuration**: How long to cache icon data in seconds
119+
120+
#### Icon Type Settings
121+
122+
- **enabledIconTypes**: Enable/disable specific icon set types
123+
- `svg-folder` - SVG files in folders (stable, production-ready)
124+
- `svg-sprite` - SVG sprite files (beta)
125+
- `font-awesome` - Font Awesome icons (beta)
126+
- `material-icons` - Material Icons and Material Symbols (beta)
127+
128+
### Precedence
129+
130+
Settings are loaded in this order (later overrides earlier):
131+
132+
1. Default plugin settings
133+
2. Database-stored settings (from CP)
134+
3. Config file settings
135+
4. Environment-specific config settings
136+
137+
### Performance Recommendations
138+
139+
For production environments:
140+
141+
```php
142+
'production' => [
143+
'enableCache' => true,
144+
'cacheDuration' => 2592000, // 30 days for maximum performance
145+
'iconSetsPath' => '@webroot/dist/assets/icons', // Pre-built icons
146+
'enabledIconTypes' => [
147+
'svg-folder' => true, // Only stable features
148+
],
149+
],
150+
```
151+
152+
### Security Recommendations
153+
154+
```php
155+
// Use environment variables for sensitive paths
156+
'iconSetsPath' => App::env('ICON_SETS_PATH') ?: '@root/icons',
157+
158+
// Limit cache duration in shared environments
159+
'cacheDuration' => min((int)getenv('CACHE_DURATION') ?: 86400, 604800), // Max 7 days
160+
```
161+
162+
## Icon Metadata Configuration
163+
164+
You can also configure icon metadata files alongside your icon configuration. See the main README for details on `metadata.json` structure and multilingual label support.

0 commit comments

Comments
 (0)