PHPackages                             zohaibtariq/count-gpt-token - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. zohaibtariq/count-gpt-token

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zohaibtariq/count-gpt-token
===========================

A laravel project used to count token for chat gpt 2 &amp; 3 prompt.

1.0.0(2y ago)02.6kMITPHPPHP ^8.1

Since Aug 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/zohaibtariq/count-gpt-token)[ Packagist](https://packagist.org/packages/zohaibtariq/count-gpt-token)[ Docs](https://github.com/zohaibtariq/count-gpt-token)[ RSS](/packages/zohaibtariq-count-gpt-token/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Count ChatGPT (2,3) Token from any laravel project
==================================================

[](#count-chatgpt-23-token-from-any-laravel-project)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7a21e8e7153c167de3e41d356c5b3df20619e14b1fb3354ec2aac66dbb76516a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a6f6861696274617269712f636f756e742d6770742d746f6b656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zohaibtariq/count-gpt-token)[![Total Downloads](https://camo.githubusercontent.com/5aeea5eb7e9d3c4bafb80d3acf78e16c5e2b602a81c92d4839d564e5290ad898/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a6f6861696274617269712f636f756e742d6770742d746f6b656e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zohaibtariq/count-gpt-token)

It will count tokens for chatgpt (2, 3) prompt

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require zohaibtariq/count-gpt-token:dev-main
```

Usage
-----

[](#usage)

```
use CountGptToken;
CountGptToken::count_token('hello world'); // it can be your chatgpt2 or chatgpt3 prompt
```

compare results from online playground [OPEN AI PLAYGROUND TOKEN COUNT](https://platform.openai.com/tokenizer)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Zohaib Tariq](https://github.com/zohaibtariq)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1057d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9897050?v=4)[Zohaib Tariq - Full Stack - Web Developer (MERN - MEAN - AI - LAMP)](/maintainers/zohaibtariq)[@zohaibtariq](https://github.com/zohaibtariq)

---

Top Contributors

[![zohaibtariq](https://avatars.githubusercontent.com/u/9897050?v=4)](https://github.com/zohaibtariq "zohaibtariq (4 commits)")

---

Tags

phplaraveltokenencoderChatGpttiktokengpt3zohaibtariqcount-gpt-tokengpt2

### Embed Badge

![Health badge](/badges/zohaibtariq-count-gpt-token/health.svg)

```
[![Health](https://phpackages.com/badges/zohaibtariq-count-gpt-token/health.svg)](https://phpackages.com/packages/zohaibtariq-count-gpt-token)
```

###  Alternatives

[rajentrivedi/tokenizer-x

TokenizerX calculates required tokens for given prompt

92252.4k3](/packages/rajentrivedi-tokenizer-x)[amranidev/laracombee

Recommendation system for laravel

11538.8k1](/packages/amranidev-laracombee)[yieldstudio/tailwind-merge-php

Merge Tailwind CSS classes without style conflicts

4975.4k1](/packages/yieldstudio-tailwind-merge-php)[wujunze/money-wrapper

MoneyPHP Wrapper

103.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
