Have you ever wanted to add AI to your Laravel app? Maybe you want it to answer user questions, give smart suggestions, or even write something on its own. Sounds cool, right?
In this article, we’ll show you how to make your AI app smarter, more reliable, and easier to manage using a tool called GptSdk.
An AI application is just like a normal app—but with a brain! You give it some input (like a question or request), and it gives you a smart answer using AI.
To make this work, we give the AI instructions called prompts. These prompts help the AI understand what it should do.
Here’s the problem: AI isn’t always consistent. You might write a prompt that works great most of the time. But then a user asks something unusual—and the AI gives a weird or wrong answer.
That’s frustrating. And it means we need to test prompts with lots of different inputs to make sure they work well.
Many developers try to manage prompts using third-party tools, called prompt managers. But these tools have a lot of problems:
This gets messy fast—especially if your app uses a lot of prompts.
Here’s the good news: GptSdk fixes all of this.
It lets you keep all your prompts in your own GitHub repo, safely stored and versioned just like your code. No one else has access to them. No third-party snapshots. You stay in control.
🔧 Create a new GitHub repository.
🔗 Connect it to the GptSdk UI.
✍️ Write your prompt and test it with different inputs and models.
✅ Save it—your changes are committed to your repo automatically.
You now have a clean, version-controlled prompt system that’s ready for production!
To use your prompts, just install the library with:
composer require saassdk/gptsdk-php
GptSdk will fetch your prompts and run them locally using the inputs you define. You just need to provide the GitHub URL and a token.
resetPromptCache();
$completionAi = new CompletionAi(
[
'openai' => new OpenAIVendor(HttpClient::create()),
'anthropic' => new AnthropicAIVendor(HttpClient::create())
],
[
CompilerType::DOUBLE_BRACKETS->value => new DoubleBracketsPromptCompiler()
],
new GithubPromptStorage(
HttpClient::create(),
$githubOwner,
$githubRepositoryName,
$githubToken,
$tempLocalPromptStorage
)
);
print_r(
$completionAi->complete([
new AiRequest(
apiKey: $openAiToken,
aiVendor: 'openai',
llmOptions: ['model' => 'gpt-3.5-turbo'],
promptPath: 'first1.prompt',
variableValues: [
'variable1' => 'Hello'
]
)
])[0]->plainResponse
);
Now your Laravel app has AI power—without relying on someone else’s API!
What if you want to test your AI app automatically?
With GptSdk, it’s easy. You can select any AI response you like in the UI, and it will be saved as a mock in your repo. Then, when you test your app, you can use that mock result—no manual editing needed.
This means faster testing, fewer bugs, and less stress.
Building an AI-powered Laravel app doesn’t have to be hard or expensive.
With GptSdk, you get:
So go ahead—build your next AI app like a pro.
👉 Try GptSdk today and bring your AI ideas to life, the Laravel way.