Skip to content

Commit 1d223b2

Browse files
1.1.0
* [*] simplify code. Added Interface. Now Package contains only 4 methods: `getExtension(mimetype) -> ext`, `fromExtension(ext) -> mimetype` (have alias `getMimeType(ext)`, `fromFilename(name.ext) -> mimetype`, `getMimeTypes() -> all ext->mimetype`
1 parent 7dcc624 commit 1d223b2

File tree

5 files changed

+1107
-1158
lines changed

5 files changed

+1107
-1158
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# What is it? %%generate_datetime%%
2+
3+
PHP package for converting file extensions to MIME types and vice versa.
4+
5+
Uses the MIME content type for a file as determined by using information from the `magic.mime` file.
6+
17
# Mimetypes
28

39
Creates a JSON document containing a thorough list of file extensions => mime types as provided by the
@@ -75,11 +81,18 @@ $ext = MimeTypes::getExtension('application/json');
7581

7682
// => .json
7783

78-
$type = MimeTypes::getMimeType('.json');
84+
$type = MimeTypes::fromExtension('.json');
7985

8086
// 'application/json'
87+
// or (use alias)
88+
89+
$type = MimeTypes::getMimeType('.json');
8190
```
8291

92+
NB:
93+
94+
'fallback' function `mime_content_type()` return all same data.
95+
8396
## License & Copyright
8497

8598
Original idea: 2010-2013 [Ryan Parman](http://ryanparman.com).

0 commit comments

Comments
 (0)