Ever started a new PHP project and dread re-implementing basic, repetitive code every damn time? Ever copy-pasted code snippets and files from one project to the next? Look no further nyu.
Puchiko is a PHP package that provides a variety of QoL features that arent available in vanilla PHP, included but not limited to:
- Feature that allows running background processes fully independent of the host request, useful for intensive databae actions.
- DOM manipulation functions via
DOMDocumentand clean HTML truncation. - Fetching the dimensions of compressed Shockwave Flash files
- Trove of string checking, normalization, and manipulation functions (building anchor tags from plain URLs and more)
- Function for building clean URLs from complex multi-parameter form inputs
- Set of functions for interfacting with the file system. Including a way to remove GPS data from jpeg images using
exiftooland creating video thumbnails usingffmpeg - Json respone functions along with cache controls, useful for API endpoints.
Its designed for the collection of scripts maintained by Heyuri (kokonotsuba, TWINTAIL UPLOADER, ksphp+) but can be deployed on any project. Its particularly useful on a script focused on user-generated content, as sanitization and DOM code is rarely ever needed to be different from project-to-project.
Some functions in Puchiko do require external tools, namely ffmpeg and exiftool, you can intall them from your operating system's package manager.
To include this in your project you just need to add the following entries to composer.json:
- Add
"heyuri/puchiko": "dev-main"torequire - Add
"url": "https://github.com/Heyuri/Puchiko"torepositories
It should look like this:
{
"name": "heyuri/kokonotsuba",
"description": "Kokonotsuba imageboard software",
"type": "project",
"license": "MIT",
"require": {
"php": ">=8.4",
"heyuri/puchiko": "dev-main"
},
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Heyuri/Puchiko"
}
],
"config": {
"vendor-dir": "vendor"
}
}then run composer update on a pre-existing project or composer install on a fresh one.