Download the PHP
package codechap/yii3-context-trimmer without Composer
On this page you can find all versions of the php package
codechap/yii3-context-trimmer. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor codechap Package yii3-context-trimmer Short Description Tokenizer-agnostic text preprocessor for trimming and optimising content for LLM context windows. License
MIT
After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.
Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.
In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories.
In this case some credentials are needed to access such packages.
Please use the auth.json textarea to insert credentials, if a package is coming from a private repository.
You can look here for more information.
Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
To use Composer is sometimes complicated. Especially for beginners.
Composer needs much resources. Sometimes they are not available on a simple webspace.
If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Informations about the package yii3-context-trimmer
Yii3 Context Trimmer
Tokenizer-agnostic text preprocessor for trimming and optimising content to fit within LLM context windows. Built for Yii3 with full DI container integration, configurable params, and a console command.
Requirements
PHP 8.2 - 8.5
Installation
For Yii3 applications using the config plugin, the DI bindings and params are registered automatically.
Usage
Via Dependency Injection (Yii3)
Inject the interface to get a pre-configured trimmer from the DI container:
Default configuration is handled via params.php — see Configuration below.
Standalone
Custom Tokenizer
The default tokenizer splits on spaces, which is a rough heuristic. For accurate token counting, provide a tokenizer matching your LLM's tokenization:
Configuration
Yii3 Params
Override defaults in your application's params.php:
Options Reference
Option
Default
Description
maxTokens
8192
Maximum tokens per output segment. Must be >= 2.
removeDuplicateLines
false
Remove duplicate non-blank lines. Blank lines are preserved as structural separators.
removeShortWords
false
Remove purely-alphabetical words shorter than minWordLength. Warning: This is aggressive and removes articles, prepositions, and pronouns.
minWordLength
2
Minimum word length to keep. Words shorter than this are removed.
removeExtraneous
false
Remove [](){}<>* characters. Warning: Destroys Markdown, HTML, and code syntax.
compressWhitespace
true
Collapse multiple whitespace characters into single spaces. Disable for code/formatted text.
Console Command
Requires yiisoft/yii-console for the Yii3 console runner.
Testing
Static Analysis
License
MIT
All versions of yii3-context-trimmer with dependencies
Composer command for our command line client (download client)This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free.Standard composer command
The package codechap/yii3-context-trimmer contains the following files
Loading the files please wait ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.