Download the PHP package publicuhc/skin-cache without Composer

On this page you can find all versions of the php package publicuhc/skin-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package skin-cache

SkinCache

SensioLabsInsight

Cache Minecraft skins/icons and serve them locally.

Dependencies

All dependencies are handled by composer. Installing cURL is recommended and will be used if installed but it isn't required.

Usage

There is a class PublicUHC\SkinCache\SimpleSkinFetcher that uses some default classes and can be used like this:

$fetcher = new SimpleSkinFetcher('https://minotar.net', 10, './cache', 3600);

To change the classes used or for better tweaking use the class PublicUHC\SkinCache\SkinFetcher.

It requires a Downloader, a Formatter, a PoolInterface and a ErrorImagePainter. It also requires a 'ttl', either null to store forever, an integer as the number of seconds until expiry or a DateTime for when the fetched skins should expire.

Downloader

There is only 1 implementation of downloader available:

PublicUHC\SkinCache\Downloaders\MinotarLikeDownloader

It fetches from a base URL supplied in a minotar-like fashion.

Skins are fetched from <base_url>/skin/<username>

Helms are fetched from <base_url>/helm/<username>/<size>.png

Heads are fetched from <base_url>/avatar/<username>/<size>.png

It expects a GuzzleHttp\Client object initialized for getting the data with. At minimum a base_url needs to be set.

$client = new GuzzleHttp\Client(['base_url' => 'https://minotar.net/']);

For more information on the Client object visit the Guzzle project on GitHub

It also expects a timeout in seconds for the fetching.

Example for fetching from minotar.net with a 30 second timeout:

$downloader = new MinotarLikeDownloader(new Client(['base_url' => 'https://minotar.net/']), 30);

Formatter

NOTE: Only the raw images are cached, any formatting is applied to the raw images

There are 3 implementations of the formatter available:

PublicUHC\SkinCache\Formatters\HttpResponseFormatter

It formats the images in a Symfony HttpResponse format from the Symfony Http Foundation project

PublicUHC\SkinCache\Formatters\RawImageFormatter

Returns the image as the raw image string

PublicUHC\SkinCache\Formatters\GreyscaleFormatter

Returns the image as a greyscale version of itself

Formatters can be chained to make multiple formatting passes:

$formatter = (new GreyscaleFormatter())->then(new HttpResponseFormatter());

This will first make it greyscale and then make it a Http Foundation response.

PoolInterface

Expects a PoolInterface from the Stash PHP Project.

Example - throws away objects, no cache:

$pool = new Pool(new BlackHole());

Example - using the default Ephemeral driver:

$pool = new Pool();

ErrorImagePainter

There is only 1 implementation of the error image painter available:

PublicUHC\SkinCache\Painters\TransparentImagePainter

It will return a transparent image of the same dimensions for error images

Full Example

The following example uses the MinotarLikeDownloader to fetch skins from the official minotar site, formats them in Http Foundation Response style and uses the default Ephemeral cache driver and then fetches the helm for the 'ghowden' account 16x16

$downloader = new MinotarLikeDownloader(new Client(['base_url'=>'https://minotar.net/']));
$fetcher = new SkinFetcher($downloader, new HttpResponseFormatter(), new Pool(), new TransparentImagePainter());

$fetcher->fetchHelm('ghowden', 16);

All versions of skin-cache with dependencies

PHP Build Version
Package Version
Requires symfony/http-foundation Version ~2.5
tedivm/stash Version ~0.11
guzzlehttp/guzzle Version ~4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package publicuhc/skin-cache contains the following files

Loading the files please wait ....