Download the PHP package accudio/php-plaiceholder without Composer

On this page you can find all versions of the php package accudio/php-plaiceholder. 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 php-plaiceholder

An externally-maintained implementation of Plaiceholder

Plaiceholder for PHP

PHP implementation of Plaiceholder - CSS, SVG, Base64 and Blurhash image placeholders.


Table of Contents

  1. Introdution
  2. Installation
  3. Setup
  4. FAQs
  5. License
  6. Acknowledgements

Introduction

Plaiceholder is a Node.js utility for generating low quality image placeholders. This package is a re-write in PHP and distributed via composer.

Plaiceholder for PHP broadly matches the original JS implementation but implements it in pure PHP and hence has a different syntax. This readme will only cover differences from the JS implementation.

For information about the strategies available, their pros and cons, and information about the original project check out the Plaiceholder docs.

Installation

Plaiceholder for PHP should ideally be installed with composer:

If using composer, make sure your application includes require_once 'vendor/autoload.php';.

You can alternatively download the repo and require the appropriate files from src/ before creating an instance.

Setup

Whichever strategy you use, you will first need to create an instance of PHPPlaiceholder for your image:

The PHPPlaiceholder object accepts an absolute path to the file as stored on your server, or the full URL for a remote image. For local images you may find the PHP function realpath() useful for getting the absolute path.

CSS

CSS strategy has three output modes:

CSS strategy on plaiceholder docs.

SVG

SVG returns a string of SVG markup. By default it will include a style attribute with absolute positioning and centering. Pass false as a first argument to prevent output of inline styles to do so yourself.

SVG strategy on plaiceholder docs.

Base64

Generates low-resolution image and encodes as base64, including data-uri and format. Ready for inserting into src attribute or url() css function.

Base64 strategy on plaiceholder docs.

Note: Due to a difference in the image library used between plaiceholder and Plaiceholder for PHP (sharp vs ImageMagick), the base64 strategy doesn't look the same. Whereas plaiceholder tweaks the saturation to make the generated image look slightly better, Imagick seems to do fairly well with no tweaking so I've not made changes. Any feedback is appreciated.

Blurhash

Creates and returns Blurhash string using php-blurhash by kornrunner.

Blurhash strategy on plaiceholder docs.

Note: Due to a difference in blurhash encoder between plaiceholder and Plaiceholder for PHP, the blurhash strategy can look slightly different in some cases. I am not familiar with blurhash but if someone who is more knowledgeable here can contribute please do.

FAQs

When should I generate plaiceholders?

Although you are able to perform plaiceholder generation on each request, it is not recommended. Especially for large images generation can take a bit of time and resources. This is made even worse by remote images, which require an additional connection in order to download the image to the server.

In production ideally you should store results in a database or file cache so you only need to generate plaiceholders for new or changed images.

Is there a plugin for XYZ?

There are currently no plugins for PHP CMS' or otherwise. I would be keen for plugins for Craft CMS and perhaps WordPress, but not at this time.

Plaiceholder for PHP is fairly simple so likely able to integrate with most platforms easily. I encourage you to make your own integrations, or feel free to build and release plugins or libraries on top of Plaiceholder for PHP - following the plaiceholder contribution guide.


License

Apache-2.0 License © Alistair Shepherd

Acknowledgements

Joe Bell (Plaiceholder)

Copyright © 2020-2021, Joe Bell. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License").

Boris Momčilović (php-blurhash)

MIT License copyright © Boris Momčilović. All Rights Reserved.

Imagick

Copyright (c) 1999 - 2011 The PHP Group. All rights reserved.


All versions of php-plaiceholder with dependencies

PHP Build Version
Package Version
Requires kornrunner/blurhash Version ^1.2
php Version >=7.2
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 accudio/php-plaiceholder contains the following files

Loading the files please wait ....