Skip to content

Commit 4a26ef9

Browse files
committed
refactor config document, use table instead
1 parent 2447eb8 commit 4a26ef9

File tree

1 file changed

+87
-177
lines changed

1 file changed

+87
-177
lines changed

docs/config.md

Lines changed: 87 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -1,182 +1,92 @@
1-
In `config/lfm.php` :
2-
3-
```php
4-
/*
5-
|--------------------------------------------------------------------------
6-
| Routing
7-
|--------------------------------------------------------------------------
8-
*/
9-
10-
// Include to pre-defined routes from package or not. Middlewares
11-
'use_package_routes' => true,
12-
13-
// Middlewares which should be applied to all package routes.
14-
// For laravel 5.1 and before, remove 'web' from the array.
15-
'middlewares' => ['web','auth'],
16-
17-
// The url to this package. Change it if necessary.
18-
'prefix' => 'laravel-filemanager',
19-
20-
// The prefix of urls to non-public files, for exmaple if: base_directory !== 'public'
21-
// Without slashes
22-
'urls_prefix' => '',
23-
24-
/*
25-
|--------------------------------------------------------------------------
26-
| Multi-User Mode
27-
|--------------------------------------------------------------------------
28-
*/
29-
30-
// If true, private folders will be created for each signed-in user.
31-
'allow_multi_user' => true,
32-
// If true, share folder will be created when allow_multi_user is true.
33-
'allow_share_folder' => true,
34-
35-
// Flexibla way to customize client folders accessibility
36-
// Ex: The private folder of user will be named as the user id.
37-
// You cant use a closure when using the optimized config file (in Laravel 5.2 anyway)
38-
'user_field' => function() {
39-
return auth()->user()->id;
40-
},
41-
42-
/*
43-
|--------------------------------------------------------------------------
44-
| Working Directory
45-
|--------------------------------------------------------------------------
46-
*/
47-
48-
// Which folder to store files in project, fill in 'public', 'resources', 'storage' and so on.
49-
// You should create routes to serve images if it is not set to public.
50-
'base_directory' => 'public',
51-
52-
'images_folder_name' => 'photos',
53-
'files_folder_name' => 'files',
54-
55-
'shared_folder_name' => 'shares',
56-
'thumb_folder_name' => 'thumbs',
57-
58-
/*
59-
|--------------------------------------------------------------------------
60-
| Startup Views
61-
|--------------------------------------------------------------------------
62-
*/
63-
64-
// The default display type for items.
65-
// Supported: "grid", "list"
66-
'images_startup_view' => 'grid',
67-
'files_startup_view' => 'list',
68-
69-
/*
70-
|--------------------------------------------------------------------------
71-
| Upload / Validation
72-
|--------------------------------------------------------------------------
73-
*/
74-
75-
// If true, the uploaded file will be renamed to uniqid() + file extension.
76-
'rename_file' => false,
77-
78-
// If rename_file set to false and this set to true, then non-alphanumeric characters in filename will be replaced.
79-
'alphanumeric_filename' => true,
80-
81-
// If true, non-alphanumeric folder name will be rejected.
82-
'alphanumeric_directory' => false,
83-
84-
// If true, the uploading file's size will be verified for over than max_image_size/max_file_size.
85-
'should_validate_size' => false,
86-
87-
'max_image_size' => 50000,
88-
'max_file_size' => 50000,
89-
90-
// If true, the uploading file's mime type will be valid in valid_image_mimetypes/valid_file_mimetypes.
91-
'should_validate_mime' => false,
92-
93-
// available since v1.3.0
94-
'valid_image_mimetypes' => [
95-
'image/jpeg',
96-
'image/pjpeg',
97-
'image/png',
98-
'image/gif',
99-
'image/svg+xml',
100-
],
101-
102-
// available since v1.3.0
103-
// only when '/laravel-filemanager?type=Files'
104-
'valid_file_mimetypes' => [
105-
'image/jpeg',
106-
'image/pjpeg',
107-
'image/png',
108-
'image/gif',
109-
'image/svg+xml',
110-
'application/pdf',
111-
'text/plain',
112-
],
113-
114-
/*
115-
|--------------------------------------------------------------------------
116-
| Image / Folder Setting
117-
|--------------------------------------------------------------------------
118-
*/
119-
120-
'thumb_img_width' => 200,
121-
'thumb_img_height' => 200,
122-
123-
/*
124-
|--------------------------------------------------------------------------
125-
| File Extension Information
126-
|--------------------------------------------------------------------------
127-
*/
128-
129-
'file_type_array' => [
130-
'pdf' => 'Adobe Acrobat',
131-
'doc' => 'Microsoft Word',
132-
'docx' => 'Microsoft Word',
133-
'xls' => 'Microsoft Excel',
134-
'xlsx' => 'Microsoft Excel',
135-
'zip' => 'Archive',
136-
'gif' => 'GIF Image',
137-
'jpg' => 'JPEG Image',
138-
'jpeg' => 'JPEG Image',
139-
'png' => 'PNG Image',
140-
'ppt' => 'Microsoft PowerPoint',
141-
'pptx' => 'Microsoft PowerPoint',
142-
],
143-
144-
'file_icon_array' => [
145-
'pdf' => 'fa-file-pdf-o',
146-
'doc' => 'fa-file-word-o',
147-
'docx' => 'fa-file-word-o',
148-
'xls' => 'fa-file-excel-o',
149-
'xlsx' => 'fa-file-excel-o',
150-
'zip' => 'fa-file-archive-o',
151-
'gif' => 'fa-file-image-o',
152-
'jpg' => 'fa-file-image-o',
153-
'jpeg' => 'fa-file-image-o',
154-
'png' => 'fa-file-image-o',
155-
'ppt' => 'fa-file-powerpoint-o',
156-
'pptx' => 'fa-file-powerpoint-o',
157-
],
158-
159-
/*
160-
|--------------------------------------------------------------------------
161-
| php.ini override
162-
|--------------------------------------------------------------------------
163-
*/
164-
// These values override your php.ini settings before uploading files
165-
// Set these to false to ingnore and apply your php.ini settings
166-
'php_ini_overrides' => [
167-
'memory_limit' => '256M'
168-
],
169-
```
170-
171-
## Caveats
172-
### php.ini overrides
173-
174-
The php_ini_overrides are applied on every request the filemanager does and are reset once the script has finished executing.
1+
**The config is in `config/lfm.php`.**
2+
3+
## Routing:
4+
5+
| Key | Type | Description |
6+
|--------------------|---------|--------------------------------------------------------------------------------------------------------------|
7+
| use\_package\_routes | boolean | Use routes from package or not. If false, you will need to define routes to all controllers of this package. |
8+
| middlewares | array | Middlewares to be applied to default routes. For laravel 5.1 and before, remove 'web' from the array. |
9+
| prefix | string | The url prefix to this package. Change it if necessary. |
10+
11+
12+
## Multi-User Mode:
13+
14+
| Key | Type | Description |
15+
|--------------------|---------|------------------------------------------------------------------------------------------------|
16+
| allow\_multi\_user | boolean | If true, private folders will be created for each signed-in user. |
17+
| allow\_share\_folder | boolean | If true, share folder will be created. |
18+
| user_field | string | Private folders will be named by this. Can receive column name of `users` table or class name. |
19+
20+
### If you want to name private folders other than columns of users table, follow these steps:
21+
1. Run `php artisan vendor:publish --tag=lfm_handler`.
22+
2. Fill `App\Handler\ConfigHander::class` into `user_field`.
23+
3. Edit `userField()` in the `App\Handler\ConfigHander`
24+
25+
26+
## Working Directory:
27+
28+
| Key | Type | Description |
29+
|--------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
30+
| base_directory | string | Which folder to store files in project, fill in 'public', 'resources', 'storage' and so on. Does not support path relative path like `../public_html` or `public/upload/user/`. |
31+
| images\_folder\_name | string | Does not support path relative path like `../public_html` or `public/upload/user/`. |
32+
| files\_folder\_name | string | Does not support path relative path like `../public_html` or `public/upload/user/`. |
33+
| shared\_folder\_name | string | Does not support path relative path like `../public_html` or `public/upload/user/`. |
34+
| thumb\_folder\_name | string | Does not support path relative path like `../public_html` or `public/upload/user/`. |
35+
36+
37+
## Startup Views:
38+
39+
| Key | Type | Description |
40+
|---------------------|--------|-----------------------------------------------------------------|
41+
| images\_startup\_view | string | The default display type for images. Supported: "grid", "list". |
42+
| files\_startup\_view | string | The default display type for files. Supported: "grid", "list". |
43+
44+
45+
## Upload / Validation:
46+
47+
| Key | Type | Description |
48+
|-------------------------|---------|--------------------------------------------------------------------------|
49+
| rename_file | string | If true, the uploaded file will be renamed to uniqid() + file extension. |
50+
| alphanumeric_filename | string | If true, non-alphanumeric file name will be replaced with `_`. |
51+
| alphanumeric_directory | boolean | If true, non-alphanumeric folder name will be rejected. |
52+
| should\_validate\_size | boolean | If true, the size of uploading file will be verified. |
53+
| max\_image\_size | int | Specify max size of uploading image. |
54+
| max\_file\_size | int | Specify max size of uploading file. |
55+
| should\_validate\_mime | boolean | If true, the mime type of uploading file will be verified. |
56+
| valid\_image\_mimetypes | array | Array of mime types. Available since v1.3.0 . |
57+
| valid\_file\_mimetypes | array | Array of mime types. Available since v1.3.0 . |
58+
59+
60+
## Thumbnail dimensions:
61+
62+
| Key | Type | Description |
63+
|------------------|--------|--------------------------------------------------|
64+
| thumb\_img\_width | string | Width of thumbnail made when image is uploaded. |
65+
| thumb\_img\_height | string | Height of thumbnail made when image is uploaded. |
66+
67+
68+
## File Extension Information
69+
70+
| Key | Type | Description |
71+
|-----------------|-------|---------------------------------------------|
72+
| file\_type\_array | array | Map file extension with display names. |
73+
| file\_icon\_array | array | Map file extension with icons(font-awsome). |
74+
75+
76+
## php.ini override
77+
78+
| Key | Type | Description |
79+
|-------------------|-----------------|-----------------------------------------------------------------------------------------------------------------------------------|
80+
| php\_ini\_overrides | array or boolean | These values override your php.ini settings before uploading files. Set these to false to ingnore and apply your php.ini settings |
81+
82+
### Caveats
83+
84+
The php\_ini\_overrides are applied on every request the filemanager does and are reset once the script has finished executing.
17585
This has one drawback: any ini settings that you might want to change that apply to the request itself will not work.
17686

17787
For example, overriding these settings will not work:
178-
* upload_max_filesize
179-
* post_max_size
88+
* upload\_max\_filesize
89+
* post\_max\_size
18090

18191
**Why this is expected behaviour:**
182-
upload_max_filesize and post_max_size will get set but uploaded files are already passed to your PHP script before the settings are changed.
92+
upload\_max\_filesize and post\_max\_size will get set but uploaded files are already passed to your PHP script before the settings are changed.

0 commit comments

Comments
 (0)