Skip to content

antonshell/placeholder-service

Repository files navigation

Placeholder service

There is a self-hosted service for images placeholders generation. Service works similar way as https://placeholder.com/, but self-hosted.

SSH Deploy Tests Code Coverage

Full code coverage report: http://files.antonshell.me/github-actions/placeholder-service/master/coverage/coverage/

Psalm html report: http://files.antonshell.me/github-actions/placeholder-service/master/psalm/psalm-report.html

Install in docker

1 . Clone repository

git clone https://github.com/antonshell/placeholder-service.git

2 . Run containers

cd placeholder-service
docker-compose up

3 . Install dependencies

docker-compose exec php-fpm composer install

4 . Open in browser

http://127.0.0.1:16880/ - Healthcheck

http://127.0.0.1:16880/img - Default image

Demo

https://placeholder.antonshell.me/img?width=500

Usage

1 . Healthcheck

https://placeholder.antonshell.me/

2 . Get default image (300x300)

https://placeholder.antonshell.me/img

300x300

3 . Set image size

500x500

400x400

320x240

4 . Set custom text

https://placeholder.antonshell.me/img?text=Hello

custom text

5 . Set text size (default: 28)

https://placeholder.antonshell.me/img?width=800&text_size=40

text size

6 . Set text color

https://placeholder.antonshell.me/img?color_text=000

text color

7 . Set background color

https://placeholder.antonshell.me/img?color_bg=000

text color

8 . Set format (PNG, JPEG, GIF)

https://placeholder.antonshell.me/img?format=png

PNG

https://placeholder.antonshell.me/img?format=jpeg

JPEG

https://placeholder.antonshell.me/img?format=gif

GIF

Tests

1 . Run tests

Local environment:

composer test

Docker environment:

docker-compose exec php-fpm composer test

2 . Update code coverage badges

Local environment:

composer update-badges

Docker environment:

docker-compose exec php-fpm composer update-badges

Codestyle

1 . Fix codestyle

composer cs-fixer src
docker-compose exec php-fpm composer cs-fixer src

2 . Code quality with Psalm

composer psalm
composer psalm-report-html

docker-compose exec php-fpm composer psalm
docker-compose exec php-fpm composer psalm-report-html

Open in browser: psalm-report.html

Composer require checker

wget https://github.com/maglnet/ComposerRequireChecker/releases/download/4.10.0/composer-require-checker.phar
docker-compose exec php-fpm composer require-check

More details: https://github.com/maglnet/ComposerRequireChecker

Macos docker environment(Mutagen)

1 . Install mutagen

brew install mutagen-io/mutagen/mutagen
mutagen daemon start

2 . Run containers

docker-compose down --remove-orphans || true
mutagen project start || mutagen project terminate

3 . Troubleshooting:

Fix permissions:

docker-compose exec php-fpm chmod -R 777 /var/www

Disable permission tracking:

git config core.fileMode false

Setup xdebug (Docker)

https://blog.denisbondar.com/post/phpstorm_docker_xdebug

About

Self hosted image placeholder service, similar to https://placeholder.com/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published