king52311 / yii2-filemanage
File Manage for Yii2
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2025-06-08 08:47:46 UTC
README
File Manage for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist king52311/yii2-filemanage "*"
or add
"king52311/yii2-filemanage": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
use king52311\filemanage\Filemanage; ...... public function actionTest2() { $list = Filemanage::showFileList('./','/base/path/','aaa.txt'); var_dump($list);exit; }
Params
- the first params is search directory relative path
- the second params is will to substr base path for relative path
- the third params is search file name to filter files.
Result
... ...
8 =>
array (size=4)
'file_path' => string './files/' (length=8)
'file_name' => string 'files' (length=5)
'file_type' => int 2
'file_ids' => string '' (length=0)
9 =>
array (size=4)
'file_path' => string './index.php' (length=11)
'file_name' => string 'index.php' (length=9)
'file_type' => int 1
'file_ids' => string '' (length=0)
10 =>
array (size=4)
'file_path' => string './robots.txt' (length=12)
'file_name' => string 'robots.txt' (length=10)
'file_type' => int 1
'file_ids' => string '' (length=0)
11 =>
array (size=4)
'file_path' => string './test.php' (length=10)
'file_name' => string 'test.php' (length=8)
'file_type' => int 1
'file_ids' => string '' (length=0)
... ...
file_type: 1 file 2 directory