1. Go to this page and download the library: Download crazzy501/gpt-3-encoder-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
crazzy501 / gpt-3-encoder-php example snippets
$encoder = new \GPT3Encoder\Gpt3Encoder();
$prompt = "Many words map to one token, but some don't: indivisible. Unicode characters like emojis may be split into many tokens containing the underlying bytes: 🤚🏾 Sequences of characters commonly found next to each other may be grouped together: 1234567890";
$token_array = $encoder->encode($prompt);
$original_text = $encoder->decode($token_array);