Download the PHP package livetyping/hermitage without Composer
On this page you can find all versions of the php package livetyping/hermitage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download livetyping/hermitage
More information about livetyping/hermitage
Files in livetyping/hermitage
Informations about the package hermitage
Hermitage
How often do you have to store images that were uploaded by users? Probably, very often. Putting these images into mobile applications is not so simple, because there are many devices with different parameters. A solution comes with Hermitage.
Hermitage is a micro-service based on Slim. It provides storage, delivery and modification of your images for clients and devices you want. Hermitage can:
- Take and put the image through the simple REST API
- Use local file system or Amazon S3 as a repository. And you can easily write your own adapter if needed.
- Put the image in one of preset formats. You can add your own - it's a matter of seconds!
And all of it is out of the box. Amazing! In addition, Hermitage is very simple and easy to use. The information bellow will cover the details. So, let's begin!
Installation
At first, you will need to install a composer lib and after that - to add a config file, then create an index file for your web-server and set environment variables. You can do it either by hand, or by using pre-setted skeleton (Hermitage Skeleton) and skip this section.
Run the Composer command to install:
Config file
You can put your config in config/main.php
or so.
Environment variables
Copy the .env.example
file to a local .env
and configure it:
The local .env
file looks like this:
NOTE: Set AUTH_SECRET
to some random string.
Index file
You can put it in public/index.php
or so.
REST API
Hermitage provides a simple API so you could upload, download and delete your images.
Signing write requests
To write to Hermitage a user agent will have to be specified by two request headers:
X-Authenticate-Signature
and X-Authenticate-Timestamp
.
X-Authenticate-Signature
is, like the access token, an HMAC (also using SHA-256 and the secret key).
The data for the hash is generated with the following elements:
- HTTP method (POST or DELETE)
- The URI
- UTC timestamp (integer only)
These elements are concatenated in the previous order with |
as a delimiter character,
and the hash is generated with the secret key.
The following snippet shows how it can be accomplished with PHP when deleting the image:
Upload
results in:
Delete
Deleting images from Hermitage can be done by requesting image's URIs with HTTP DELETE
.
Get
Getting an original (optimized) version of the image:
Getting another version of the image:
where <version>
is the version name of the image from config file (like "small", "thumb", etc.)
License
Hermitage is licensed under the MIT license.
See the LICENSE file for more information.
All versions of hermitage with dependencies
ext-apcu Version *
slim/slim Version ~3.4
php-di/slim-bridge Version ~1.0
doctrine/cache Version ~1.4
monolog/monolog Version ~1.19
simple-bus/message-bus Version ~2.2
vlucas/phpdotenv Version ~2.0
league/flysystem Version ~1.0
league/flysystem-aws-s3-v3 Version ~1.0
league/flysystem-cached-adapter Version ~1.0
nesbot/carbon Version ~1.21
frostealth/php-shortid-helper Version ~1.0
slim/http-cache Version ~0.3
intervention/image Version ~2.3
beberlei/assert Version ~2.0