adrian-mid / humhub-klipy
Add GIF search and attachment to HumHub posts and comments via the KLIPY API.
Package info
github.com/Adrian-MID/humhub-klipy
Type:humhub-module
pkg:composer/adrian-mid/humhub-klipy
Requires
- php: >=8.0
- ext-curl: *
- composer/installers: ^2.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.75
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9.6
This package is auto-updated.
Last update: 2026-07-07 05:37:51 UTC
README
Add GIF search and attachment to HumHub posts and comments using the KLIPY API.
Features
- GIF picker on post and comment upload menus
- Search and trending GIF grids with load-more button and infinite scroll
- Selected GIFs are downloaded server-side and attached like regular file uploads
- Admin settings for API key, locale, and content filter
- Optional API key from environment variables
Requirements
- HumHub 1.14 or later
- PHP 8.0 or later (with
curlextension) - A KLIPY API key (test or production) from the KLIPY Partner Panel
Installation
Use a separate Composer project in protected/modules/. The module installs to protected/modules/humhub-klipy/ and its dependencies go to protected/modules/vendor/, leaving HumHub's protected/vendor/ tree untouched.
Do not run composer init or composer require at the HumHub web root.
One-time setup - copy the Composer scaffold (once per HumHub instance):
cd /path/to/humhub/protected/modules
curl -fsSL https://raw.githubusercontent.com/Adrian-MID/humhub-klipy/main/modules.composer.json -o composer.json
Install or update:
cd /path/to/humhub/protected/modules
composer require adrian-mid/humhub-klipy:^1.0
php ../yii cache/flush-all
Enable HumHub Klipy under Administration → Modules.
Configure the module under Administration → Settings → HumHub Klipy.
Configuration
| Setting | Description |
|---|---|
| Enable GIF picker | Activates the GIF button on post and comment forms |
| KLIPY API Key | Your KLIPY API key |
| API Key Environment Variable | Optional env var name (e.g. KLIPY_API_KEY) |
| Locale | Region code such as en_US |
| Content filter | KLIPY safety filter (off, low, medium, high) |
| Download quality | KLIPY rendition to attach: full (gif), mediumgif, or tinygif (via media_filter) |
| Maximum attach size (MB) | Server-side reject limit when downloading GIFs (1–50 MB, default 10) |
Environment variables
When an environment variable name is configured and the value exists on the server, it takes precedence over the database-stored API key.
How it works
HumHub exposes file upload menus on post and comment forms through pluggable file handlers. This module registers a GIF handler that opens a KLIPY search modal.
When a user selects a GIF:
- The browser requests
/humhub-klipy/gif/attachwith the KLIPY CDN URL. - The server downloads the GIF from an allowed KLIPY host.
- HumHub stores it through the standard file upload pipeline.
- The file preview and
fileList[]hidden inputs are updated exactly like a manual upload.
GIF search requests are proxied through HumHub so the API key stays on the server. The browser JavaScript config only receives HumHub endpoint URLs and the locale - never the KLIPY API key.
Development
This module is maintained with strict static analysis, coding standards, and unit tests:
- PHPStan level 10 -
composer phpstan(module source; tests excluded) - PHP CS Fixer (PER-CS + PHP 8.2 migration rules) -
composer cs:check/composer cs:fix - PHPUnit 9 -
composer test(38 tests)
Run all checks:
composer install composer lint
CI runs the same checks on push and pull requests via GitHub Actions.
License
GPL-3.0-or-later - see LICENSE.
Changelog
See CHANGELOG.md.