Squeezer
PHP library minifier
Install / Use
/learn @mamuz/SqueezerREADME
Squeezer
Squeezer is a minifier for php class files. It will parse your directories to find valid classes, interfaces and traits and squeeze them to one file. Autoloading in php is quite nice but also expensive. Sometimes too expensive for production. Using a minified file reduces the execution time of your application but increases the memory usage. Take care which directories or packages you want to squeeze. For production you should only squeeze used packages.
Installation
The recommended way to install
mamuz/squeezer is through
composer by adding dependency to your composer.json:
{
"require-dev": {
"mamuz/squeezer": "0.*"
}
}
Features
- Minify classes, interfaces and traits to one compressed file.
- Validates availability of class dependencies.
- Removing comments and docblocks is optional to keep interoperability to annotation parser.
- PHP files with more than one class, interface or trait declarations will be skipped.
- PHP files with
include,include_once,requireorrequire_oncestatements will be skipped. - PHP files with function calls to handle files like
fopenormkdirwill be skipped. - PHP files with a
declarestatement will be skipped.
Usage
Run this command line to squeeze your library without comments to classes.min.php:
./vendor/bin/squeeze classes.min.php --source="module/*/src, vendor/zendframework/*/src" --exclude="zend-loader" --nocomments
For instance, we are using a typical ZendFramework Application, but you can adapt this command to each environment
After that you can include classes.min.php inside your index.php, but before loading composer autoloader.
For instance...
//...
include_once 'classes.min.php';
include_once 'vendor/autoload.php'; // composer autoloader
//...
Use this command to get synopsis about all arguments
./vendor/bin/squeeze --help
Related Skills
node-connect
347.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.6kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.6kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
