Skip to content

Commit a51586c

Browse files
committed
change FileEntry to FileApi
1 parent 6138145 commit a51586c

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

readme.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
## FileEntry API
1+
## Laravel File API
22

33
### Introduction
44

5-
FileEntry API is good way to handle files with Laravel Storage.
5+
Laravel File API is good way to handle files with Laravel Storage.
66

7-
### Install FileEntry
7+
### Install File API
88

99
composer.json:
1010

1111
"require" : {
12-
"unisharp/laravel-fileentry" : "dev-master"
12+
"unisharp/laravel-fileapi" : "dev-master"
1313
},
1414
"repositories": {
1515
"type": "git",
16-
"url": "https://github.com/UniSharp/laravel-fileentry.git
16+
"url": "https://github.com/UniSharp/laravel-fileapi.git
1717
}
1818

1919
save it and then
2020

2121
composer update
2222

23-
### Initialize FileEntry
23+
### Initialize File API
2424

25-
use \Unisharp\FileEntry\FileEntry;
25+
use \Unisharp\FileApi\FileApi;
2626

27-
$entry = new FileEntry();
27+
$fa = new FileApi();
2828

2929
or
3030

31-
$entry = new FileEntry('/images'); # initialize it by giving a base path
31+
$fa = new FileApi('/images'); # initialize it by giving a base path
3232

3333

3434
### Save to Storage By Giving Lravel Upload File
@@ -37,55 +37,55 @@ or
3737

3838
get unique filename
3939

40-
$file = $entry->save(\Input::file('image')); // => wfj412.jpg
40+
$file = $fa->save(\Input::file('image')); // => wfj412.jpg
4141

4242
or input files is an array
4343

4444
$files = [];
4545
foreach (\Input::file('images') as $file) {
46-
$files []= $entry->save('images');
46+
$files []= $fa->save('images');
4747
}
4848

4949
* Custimize your upload file name
5050

51-
$file = $entry->save('image', 'custimized_filename'); // => custimized_filename.jpg
51+
$file = $fa->save('image', 'custimized_filename'); // => custimized_filename.jpg
5252
5353

5454
### Get file fullpath
5555

56-
$entry->fullpath('wfj412.jpg'); // => '/images/wfj412.jpg'
56+
$fa->getFullPath('wfj412.jpg'); // => '/images/wfj412.jpg'
5757

5858
### Routing your files
5959

60-
All uploaded files cannot found in public folder, because FileEntry use Laravel Storage to store them.
60+
All uploaded files cannot found in public folder, because FileApi use Laravel Storage to store them.
6161
You can write a routing rules to get it. it will response file content and use http cache by default.
6262

6363
Route::get('/upload/{filename}', function ($filename) {
64-
$entry = new FileEntry();
65-
return $entry->response($filename);
64+
$fa = new FileApi();
65+
return $fa->getResponse($filename);
6666
});
6767

6868
and it can add headers array by optional
6969

70-
return $entry->response($filename, ['Content-Disposition', 'attachement']);
70+
return $fa->getResponse($filename, ['Content-Disposition', 'attachement']);
7171

7272
### Parse File Path to URL
7373
if you store your file into cloud storage and you want to get url cloud site,
7474
you can use url() method to get it
7575

76-
$entry->url('wfjsdf.jpg'); // => "https://s3-ap-northeast-1.amazonaws.com/xxx/xxx/55c1e027caa62L.png"
76+
echo $fa->getUrl('wfjsdf.jpg'); // => "https://s3-ap-northeast-1.amazonaws.com/xxx/xxx/55c1e027caa62L.png"
7777

7878
### Work with Laravel Storage
7979

8080
* Get file content
8181

82-
\Storage::get($entry->fullpath('wfj412.jpg'));
82+
\Storage::get($fa->getPath('wfj412.jpg'));
8383
8484
* Write files
8585

86-
\Storage::put($entry->fullpath('wfj412.jpg'));
86+
\Storage::put($fa->getPath('wfj412.jpg'));
8787
8888
* Get Mime Type
8989

90-
\Storage::mimeType($entry->fullpath('wfj412.jpg'));
90+
\Storage::mimeType($fa->getPath('wfj412.jpg'));
9191

0 commit comments

Comments
 (0)