Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ vite.config.ts.timestamp-*
test-traces
**/adapters/output
.nitro
.output
.output

*/backend/storage/framework/views
51 changes: 50 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ This directory contains comprehensive examples demonstrating TanStack AI across
Choose an example based on your use case:

- **Want a full-stack TypeScript app?** β†’ [TanStack Chat (ts-react-chat)](#tanstack-chat-ts-react-chat)
- **Want an e-commerce demo with AI?** β†’ [PHP Laravel E-Commerce](#php-laravel--lunar-e-commerce)
- **Want a simple CLI tool?** β†’ [CLI Example](#cli-example)
- **Need a vanilla JS frontend?** β†’ [Vanilla Chat](#vanilla-chat)
- **Building a Python backend?** β†’ [Python FastAPI Server](#python-fastapi-server)
- **Building a PHP backend?** β†’ [PHP Slim Framework Server](#php-slim-framework-server)
Expand Down Expand Up @@ -204,9 +206,55 @@ await client.sendMessage('Hello!')

## PHP Examples

### PHP Laravel + Lunar E-Commerce

A full-featured e-commerce guitar shop built with Laravel 11+ and Lunar, featuring an AI sales assistant powered by TanStack AI.

**Tech Stack:**

- Laravel 11+ (PHP backend)
- Lunar (headless e-Commerce)
- React + Vite (frontend)
- `@tanstack/ai` PHP package (AI backend)
- `@tanstack/ai-react` (React hooks)
- `@tanstack/ai-client` (headless client)

**Features:**

- βœ… Full e-commerce functionality with Lunar
- βœ… AI sales assistant with tool calling (getInventory)
- βœ… Agentic flow with automatic tool execution
- βœ… Real-time streaming with SSE
- βœ… Product catalog with images and pricing
- βœ… Shopping cart management
- βœ… Beautiful sidebar chat interface
- βœ… Support for Anthropic and OpenAI

**Getting Started:**

```bash
cd examples/php-laravel

# One-command setup (installs deps, sets up database, seeds products)
pnpm run setup

# Copy environment file and add API keys
cp backend/.env.example backend/.env
# Edit backend/.env and add your ANTHROPIC_API_KEY

# Start both frontend and backend
pnpm start
```

Open `http://localhost:3200/`

πŸ“– [Full Documentation](php-laravel/README.md)

---

### PHP Slim Framework Server

A PHP Slim Framework server that streams AI responses in SSE format, with support for both Anthropic and OpenAI.
A lightweight PHP Slim Framework server that streams AI responses in SSE format, with support for both Anthropic and OpenAI.

**Features:**

Expand Down Expand Up @@ -295,6 +343,7 @@ AI Provider (OpenAI/Anthropic/etc.)

**Examples:**

- [PHP Laravel E-Commerce](php-laravel/README.md) - Full-stack with Laravel + React
- [Python FastAPI](python-fastapi/README.md) + [Vanilla Chat](vanilla-chat/README.md)
- [PHP Slim](php-slim/README.md) + [Vanilla Chat](vanilla-chat/README.md)
- [PHP Slim](php-slim/README.md) + any frontend with `@tanstack/ai-client`
Expand Down
20 changes: 20 additions & 0 deletions examples/php-laravel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Backend
backend/vendor/
backend/.env
backend/.env.backup
backend/.phpunit.result.cache

# Frontend
frontend/node_modules/
frontend/dist/
frontend/.vite/

# IDE
.idea/
.vscode/
.fleet/
.nova/

# OS
.DS_Store
Thumbs.db
Loading
Loading