Sign inSign up

microsnail/php

By microsnail

•Updated almost 8 years ago

Dockerized PHP utilities

Image
0

254

microsnail/php repository overview

⁠PHP utilities

This image is built upon official Alpine PHP image enhanced with JavaScript and CSS minification utility based on matthiasmullie/minify⁠. There are images for PHP 7.0, 7.1, 7.2 and 7.3 versions available, so choose the one according to your needs using the appropriate image tag.

⁠How to use it

⁠General usage

In general you can use the image for any PHP related task, just run

docker run microsnail/php:$TAG <any php command>

However, there are two examples described in more details bellow.

⁠VSCode PHP linting

If you work on more projects, you may have to cope with more versions of PHP. It would be mess to have them all installed on one PC, but containers can solve this in an elegant way.

If you use Visual Studio Code for your development, you can use this script⁠ to lint PHP files in your projects:

  1. choose the version of PHP you use
  2. set php.validate.executablePath to the script⁠

The script is Windows batch, but it can be easily re-written to Unix/Linux shell script.

⁠JS and CSS minification

JavaScript and CSS files minification is a good practice for web pages and applications. There are a lot of minification utilities, our PHP image has one of them baked in. To use it run:

docker run --rm -v $HOSTDATADIRECTORY:/data:rw microsnail/php:$TAG php -f ms_minify.php /data $FILESTOBEMINIFIED

where

  • $HOSTDATADIRECTORY is directory containing your JavaScript and CSS files.
  • $TAG is tag of image according to your needs
  • $FILESTOBEMINIFIED is list to files to be minified (relative path to $HOSTDATADIRECTORY

⁠More resources

You can find more information (like Dockerfile, helper scripts and contact) at Microsnail docker apps and utils⁠ page.

Tag summary

Content type

Image

Digest

Size

40.4 MB

Last updated

almost 8 years ago

docker pull microsnail/php:7.3