aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2014-02-24 15:50:10 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2014-02-24 15:50:10 +0100
commit7afac85d56973c3851e10761ba278b1805aab565 (patch)
tree26584fdf09fd9bde24b99ebab5561f39d21182ac /README.md
parent23cf49aa87c1294c18e2c9c4529bcc107cb87415 (diff)
downloadMime-7afac85d56973c3851e10761ba278b1805aab565.zip
Mime-7afac85d56973c3851e10761ba278b1805aab565.tar.gz
Mime-7afac85d56973c3851e10761ba278b1805aab565.tar.bz2
Add syntax highlighting.
Diffstat (limited to 'README.md')
-rw-r--r--README.md80
1 files changed, 43 insertions, 37 deletions
diff --git a/README.md b/README.md
index dc5071e..c18f748 100644
--- a/README.md
+++ b/README.md
@@ -19,29 +19,33 @@ All we need is static methods `Hoa\Mime\Mime::getExtensionsFromMime` to get
extensions from a type and `Hoa\Mime\Mime::getMimeFromExtension` to get type
from an extension:
- print_r(Hoa\Mime\Mime::getExtensionsFromMime('text/html'));
-
- /**
- * Will output:
- * Array
- * (
- * [0] => html
- * [1] => htm
- * )
- */
-
- var_dump(Hoa\Mime\Mime::getMimeFromExtension('webm'));
-
- /**
- * Will output:
- * string(10) "video/webm"
- */
+```php
+print_r(Hoa\Mime\Mime::getExtensionsFromMime('text/html'));
+
+/**
+ * Will output:
+ * Array
+ * (
+ * [0] => html
+ * [1] => htm
+ * )
+ */
+
+var_dump(Hoa\Mime\Mime::getMimeFromExtension('webm'));
+
+/**
+ * Will output:
+ * string(10) "video/webm"
+ */
+```
By default, `Hoa\Mime\Mime` uses the `hoa://Library/Mime/Mime.types` file as
database. We can change this behavior by calling the `Hoa\Mime\Mime::compute`
before any computations:
- Hoa\Mime\Mime::compute('/etc/mime.types');
+```php
+Hoa\Mime\Mime::compute('/etc/mime.types');
+```
### Stream-related informations
@@ -49,25 +53,27 @@ By instanciating the `Hoa\Mime\Mime` class with a stream, we are able to get
some informations about the stream, such as its extension, others extensions,
type, etc. Thus:
- $type = new Hoa\Mime\Mime(new Hoa\File\Read('index.html'));
-
- var_dump(
- $type->getExtension(),
- $type->getOtherExtensions(),
- $type->getMime(),
- $type->isExperimental()
- );
-
- /**
- * Will output:
- * string(4) "html"
- * array(1) {
- * [0]=>
- * string(3) "htm"
- * }
- * string(9) "text/html"
- * bool(false)
- */
+```php
+$type = new Hoa\Mime\Mime(new Hoa\File\Read('index.html'));
+
+var_dump(
+ $type->getExtension(),
+ $type->getOtherExtensions(),
+ $type->getMime(),
+ $type->isExperimental()
+);
+
+/**
+ * Will output:
+ * string(4) "html"
+ * array(1) {
+ * [0]=>
+ * string(3) "htm"
+ * }
+ * string(9) "text/html"
+ * bool(false)
+ */
+```
## Documentation