PHPackages                             thojou/prompt-template - 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. thojou/prompt-template

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

thojou/prompt-template
======================

PHP library for creating AI interaction prompts.

12PHP

Since Oct 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/thojou/php-prompt-template)[ Packagist](https://packagist.org/packages/thojou/prompt-template)[ RSS](/packages/thojou-prompt-template/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Prompt Template
===================

[](#php-prompt-template)

[![Static Badge](https://camo.githubusercontent.com/dd091876be639883d3ec7a5910e3a61fc9f952106be8483268cf06706590b008/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505f56657273696f6e2d253345253344382e312d626c7565)](https://camo.githubusercontent.com/dd091876be639883d3ec7a5910e3a61fc9f952106be8483268cf06706590b008/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505f56657273696f6e2d253345253344382e312d626c7565)[![CI](https://github.com/thojou/php-prompt-template/actions/workflows/ci.yml/badge.svg)](https://github.com/thojou/php-prompt-template/actions/workflows/ci.yml)[![Coverage](https://camo.githubusercontent.com/0c967d746eb7f4fe28065a3b94d23faa207cd6f4a968535b20fce0310a87cf89/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d3130302532352d677265656e)](https://camo.githubusercontent.com/0c967d746eb7f4fe28065a3b94d23faa207cd6f4a968535b20fce0310a87cf89/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d3130302532352d677265656e)[![License](https://camo.githubusercontent.com/757e63e83cf61e75bd9a6dcd6e241cf8ebc11ada8d84f999fcb1a3c57c75790b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74686f6a6f752f7068702d70726f6d70742d74656d706c617465)](./LICENSE)

The **PHP Prompt Template** is a library designed to simplify dynamic text generation in AI projects. This library empowers you to effortlessly incorporate placeholders into your text and render them with dynamic values. Thanks to [yethee/tiktoken-php](https://github.com/yethee/tiktoken-php), this library also provides a straightforward way to count and retrieve the tokens of a prompt.

Requirements
------------

[](#requirements)

- PHP version &gt;= 8.1

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

[](#installation)

You can effortlessly install the **PHP Prompt Template** using the popular package manager [composer](https://getcomposer.org/).

```
composer require thojou/php-prompt-template
```

Usage
-----

[](#usage)

```
