From e855b52e867553ca8405bd17ac22319e2b00c2a9 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Sat, 8 Mar 2014 15:34:14 -0600 Subject: [PATCH] Notes and cleanup in readme --- readme.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index 17e19a9..bc5f74e 100644 --- a/readme.md +++ b/readme.md @@ -23,10 +23,14 @@ This is a basic example, showing how one would cache Minotars to your server, an #### minotar.php ``` + 60)); ``` @@ -42,10 +46,10 @@ Minotar\Minotar::avatar('connor4312'); ``` include('minotar.php'); // To serve requests, it's just a different encoder! -Minotar\Minotar::encoder('serve'); +Minotar\Minotar::encoder('server'); // Note: it is important that *nothing*, not even a blank line, is send before this -Minotar::get(@$_GET['minotar'])->send(); +Minotar\Minotar::get(@$_GET['minotar'])->send(); ``` Not too hard, eh? Read on for some more fun and advanced usage. @@ -66,12 +70,16 @@ After you call this function, subsequent MinotarDisplays that are made will use - `Minotar::encoder('url', 'http://example.com/path/to/serve.php')` - Using the "url" adapter tells Minotar that you are caching and want to serve the images locally, off the given URL. - `Minotar::encoder('raw')` - Using the "raw" encoder will simply cause the default Minotar URL to be displayed. - `Minotar::encoder('datauri')` - Using the "datauri" encoder causes Minotars to be, expected, displayed as [Data URIs](http://css-tricks.com/data-uris/). This may be useful in some cases, and is quite easy to set up. The primary disadvantage is that the client's browser will not cache the displayed Minotars. It may be desirable to use in some cases, such as displaying many small Minotars, for example. - - `Minotar::encoder('serve')` - The `serve` encoder is a bit of a special one. It returns a response (Symfony/HttpKernel) with the requested image, and caching headers built-in to tell the user's browser to cache the Minotar. This is designed to be used in tandem with the "url" encoder (see the example above). + - `Minotar::encoder('server')` - The `server` encoder is a bit of a special one. It returns a [Symfony/HttpFoundation](http://symfony.com/doc/current/components/http_foundation/introduction.html#response) response with the requested image, and caching headers built-in to tell the user's browser to cache the Minotar. This is designed to be used in tandem with the "url" encoder (see the example above). ## Closing Remarks Feel free to read through the code if you'd like a better understanding of what's happening. Fork, share, use, and contribute. +### Extending + +This package is fairly extensible. It's build around [illuminate/container](https://github.com/illuminate/container) for its dependency injection. For example, you can inject your own custom encoders or adapters if you want to (or contribute them here!), via `Minotar::app()`. Few things are bound tightly; you can inject any of your own components to minotar-php pretty easily. + ### Contributing To contribute: