Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Tokenizer X

Tokenizer X Laravel Package

rajentrivedi/tokenizer-x

Tokenizer X is a Laravel package for generating and managing secure, unique tokens in your application. Use it for API authentication, email verification, password resets, and similar flows, with configurable token length and expiry.

View on GitHub
Deep Wiki
Context7

OpenAI token calculator

Frequently asked questions about Tokenizer X
How do I install and configure Tokenizer X in a Laravel app?
Install it with a standard Composer require, and Laravel package auto-discovery registers the service provider so no manual wiring is needed. Optionally publish the config file to set your default encoding, then call the facade in two lines at the point where you need a count. The integration effort is dominated by deciding where token counting belongs in your request path, not by the package setup itself.
Does Tokenizer X support GPT-4o and the newer o200k_base encoding?
You need to verify this explicitly before relying on it, because token counts are only correct relative to a fixed vocabulary and encoding table. If the package has not been updated for newer encodings such as o200k_base, counts will be silently wrong, and typically undercounted, which is the expensive direction for budgeting. Check the supported encoding list in the docs and confirm which vocabulary table ships with the release you install.
Is Tokenizer X an OpenAI API client or does it make network calls?
No. It is a leaf-level, in-process BPE token counter that answers how many tokens a string is and nothing more. It has no runtime service dependencies, no database surface, and no queue or cache requirements, so it sits behind a facade as a pure utility. Position it before you dispatch a request to your existing OpenAI or HTTP client, never inside the response path.
Which PHP and Laravel versions does rajentrivedi/tokenizer-x support?
The package's stated constraints target Laravel 9 or newer on PHP 8.1 or newer, and the underlying logic is framework-agnostic so it can be used outside Laravel. Always verify your exact PHP minor and Laravel major against the composer constraints during a spike rather than discovering a mismatch in CI on merge day. Composer will tell you immediately if the platform requirements conflict.
Does Tokenizer X account for chat message overhead when counting multi-turn prompts?
Raw string tokenization does not include the per-message and reply-priming tokens that chat-style APIs add to every request. Naive use will therefore undercount multi-turn conversations by a meaningful margin. If accurate budgeting matters, add a framing overhead constant on top of the raw count or confirm whether the package exposes message-level overhead accounting.
What is the memory footprint of loading the BPE table under PHP-FPM?
The BPE vocabulary table is loaded into process memory, which matters when you run many PHP-FPM workers per host. Measure the peak memory of a single worker after the table is loaded and multiply by your worker pool size before shipping. Also confirm the vocabulary data ships inside the vendor directory rather than being fetched at runtime, so container builds and offline test runs behave identically.
How do I test that Tokenizer X token counts match the OpenAI API?
Run a spike where you tokenize a representative sample of your real prompts and compare the results against the usage.prompt_tokens value the API reports for the same payloads. Turn those prompt and usage pairs into golden-file fixtures so regressions in counts surface in CI. A safe rollout is shadow mode: compute and log estimated tokens alongside actual reported usage for one to two weeks before enforcing any limits.
Should I pin an exact version of Tokenizer X or use a caret constraint?
Pin to 1.0.2 exactly for the first cycle and read the diffs on upgrade. A capability change landing in a patch release suggests loose semver discipline, so a caret range like ^1.0 carries more risk than usual. Once the encoding-support question is answered and you trust the release cadence, you can widen the constraint.
Is Tokenizer X actively maintained, and what is the bus factor?
It is a single-maintainer project, so plan accordingly and avoid depending on rapid fixes. Recent patch releases have been small, with changes limited to CI workflow bumps and documentation edits, which is low production risk but also confirms a thin change surface. Review the GitHub repository for release cadence over the last twelve months, the license, and open issues before committing.
What should I use instead of strlen($prompt) / 4 for token estimation in Laravel?
A character-based heuristic like strlen($prompt) / 4 or an outbound call to a hosted tokenizer can both be replaced by Tokenizer X as a like-for-like swap. Wrap it behind an internal TokenCounter interface or port so the implementation stays replaceable if encoding support or maintenance becomes a problem. That keeps the rest of your cost estimation, context-window guardrails, and usage metering code independent of the package.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console