{"id":25565939,"url":"https://github.com/grok-php/laravel","last_synced_at":"2026-03-15T05:30:18.896Z","repository":{"id":276232219,"uuid":"928656281","full_name":"grok-php/laravel","owner":"grok-php","description":"Seamlessly integrate Grok AI into Laravel applications with an elegant, developer-friendly package. Leverage powerful AI models for chat, automation, and NLP, while maintaining Laravel's expressive simplicity.","archived":false,"fork":false,"pushed_at":"2025-02-07T02:14:22.000Z","size":444,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-07T03:16:34.228Z","etag":null,"topics":["ai-api","ai-assistant","ai-powered-applications","ai-sdk","chatbot","laravel","laravel-ai","machine-learning","php-ai-sdk","rest-api","x-ai","x-ai-grok","x-ai-grok-2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grok-php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-07T02:02:18.000Z","updated_at":"2025-02-07T02:13:40.000Z","dependencies_parsed_at":"2025-02-07T03:26:46.860Z","dependency_job_id":null,"html_url":"https://github.com/grok-php/laravel","commit_stats":null,"previous_names":["grok-php/laravel"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grok-php%2Flaravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grok-php%2Flaravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grok-php%2Flaravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grok-php%2Flaravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grok-php","download_url":"https://codeload.github.com/grok-php/laravel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239922479,"owners_count":19718968,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-api","ai-assistant","ai-powered-applications","ai-sdk","chatbot","laravel","laravel-ai","machine-learning","php-ai-sdk","rest-api","x-ai","x-ai-grok","x-ai-grok-2"],"created_at":"2025-02-20T22:21:14.461Z","updated_at":"2026-03-15T05:30:18.838Z","avatar_url":"https://github.com/grok-php.png","language":"PHP","funding_links":[],"categories":["Laravel \u0026 Framework Integrations","SDKs \u0026 Libraries","LLM Clients \u0026 Adapters"],"sub_categories":["LLM \u0026 AI clients","PHP \u0026 Laravel"],"readme":"# 🧠 Grok AI Laravel\n\n![Grok AI Laravel](assets/images/grok-laravel.png)\n\n**Seamlessly integrate Grok AI into Laravel applications with an elegant, developer-friendly package.**  \nLeverage **powerful AI models** for **chat, automation, and NLP**, while maintaining Laravel's expressive simplicity.\n\n[![Latest Version](https://img.shields.io/packagist/v/grok-php/laravel)](https://packagist.org/packages/grok-php/laravel)\n[![PHP Version](https://img.shields.io/badge/PHP-8.1%2B-blue)](https://php.net)\n[![Laravel Version](https://img.shields.io/badge/Laravel-10%2B-red)](https://laravel.com)\n[![License](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE.md)\n\n---\n\n## 📖 Table of Contents\n- [✨ Features](#-features)\n- [📦 Installation](#-installation)\n- [🚀 Quick Start](#-quick-start)\n  - [Basic Usage](#basic-usage)\n  - [Advanced Configuration](#advanced-configuration)\n- [📌 Available Grok AI Models](#-available-grok-ai-models)\n- [⚡ Streaming Responses](#-streaming-responses)\n- [🧪 Testing](#-testing)\n- [🔒 Security](#-security)\n- [🤝 Contributing](#-contributing)\n- [📄 License](#-license)\n\n---\n\n## ✨ Features\n\n✅ **Seamless Laravel Integration** – Works effortlessly with Laravel 10+  \n✅ **Simple API Client** – Access Grok AI models with a fluent, clean syntax  \n✅ **Supports All Grok AI Models** – Choose from multiple **LLM \u0026 vision models**  \n✅ **Streaming Capable** – Enable **real-time AI responses** for interactive experiences  \n✅ **Configurable Defaults** – Set your preferred model, temperature, and more  \n\n---\n\n## 📦 Installation\n\nInstall via **Composer**:\n```sh\ncomposer require grok-php/laravel\n```\n\nAfter installation, run the setup command:\n\n```sh\nphp artisan grok:install\n```\nThis command will:\n\n- Publish the configuration file (`config/grok.php`).\n- Add necessary environment variables to `.env` and `.env.example`.\n\nAdd your API key in `.env`:\n```sh\nGROK_API_KEY=your-api-key\n```\n\n---\n\n\n## 🚀 Quick Start\n\n### Basic Usage\n\n```php\nuse GrokPHP\\Laravel\\Facades\\GrokAI;\nuse GrokPHP\\Client\\Config\\ChatOptions;\nuse GrokPHP\\Client\\Enums\\Model;\n\n$response = GrokAI::chat(\n    [['role' =\u003e 'user', 'content' =\u003e 'Hello Grok!']],\n    new ChatOptions(model: Model::GROK_2)\n);\n\necho $response['choices'][0]['message']['content'];\n```\n\n### 📌 Defaults Used:\nModel: grok-2\nTemperature: 0.7\nStreaming: false\n\n### Advanced Configuration\nModify your `config/grok.php` file:\n\n```php\nreturn [\n    'api_key' =\u003e env('GROK_API_KEY'),\n    'base_uri' =\u003e env('GROK_BASE_URI', 'https://api.grok.com/v1'),\n    'default_model' =\u003e env('GROK_DEFAULT_MODEL', 'grok-2'),\n    'default_temperature' =\u003e env('GROK_DEFAULT_TEMPERATURE', 0.7),\n    'enable_streaming' =\u003e env('GROK_ENABLE_STREAMING', false),\n    'timeout' =\u003e env('GROK_API_TIMEOUT', 30),\n];\n```\n\n📌 You can override any setting dynamically:\n\n```php\n$response = GrokAI::chat(\n    [['role' =\u003e 'user', 'content' =\u003e 'Explain black holes']],\n    new ChatOptions(model: Model::GROK_2_LATEST, temperature: 1.2, stream: true)\n);\n```\n---\n\n\n\n\n## 📌 Available Grok AI Models\nGrok AI offers multiple models, each optimized for different use cases.\nThese models are available in the Model enum inside our package:\n📄 `src/Enums/Model.php`\n\n| Model Enum                  | API Model Name       | Description                                         |\n|-----------------------------|----------------------|-----------------------------------------------------|\n| `Model::GROK_VISION_BETA`     | grok-vision-beta     | Experimental vision-enabled model                   |\n| `Model::GROK_2_VISION`        | grok-2-vision        | Advanced multi-modal vision model                   |\n| `Model::GROK_2_VISION_LATEST` | grok-2-vision-latest | Latest iteration of Grok vision models              |\n| `Model::GROK_2_VISION_1212`   | grok-2-vision-1212   | Enhanced vision model with performance improvements |\n| `Model::GROK_2_1212`          | grok-2-1212          | Optimized chat model                                |\n| `Model::GROK_2`               | grok-2               | Default general-purpose Grok model                  |\n| `Model::GROK_2_LATEST`        | grok-2-latest        | Latest iteration of Grok-2                          |\n| `Model::GROK_BETA`            | grok-beta            | Experimental beta model                             |\n\n#### 📌 Default model used: `Model::GROK_2`\n---\n\n\n## ⚡ Streaming Responses\nEnable real-time AI responses by setting `stream: true`:\n\n```php\n$response = GrokAI::chat(\n    [['role' =\u003e 'user', 'content' =\u003e 'Tell me a story']],\n    new ChatOptions(model: Model::GROK_2, stream: true)\n);\n```\nStreaming is useful for chatbots, assistants, and real-time applications.\n---\n\n## 🧪 Testing\nRun tests using Pest PHP:\n\n```sh\ncomposer test\nor\nvendor/bin/phpunit\n```\n\n## 🔒 Security\nIf you discover a security vulnerability, please report it via email:\n📩 [thefeqy@gmail.com](mailto:thefeqy@gmail.com)   \n\n## 🤝 Contributing\n\nWant to improve this package? Check out [CONTRIBUTE.md](CONTRIBUTE.md) for contribution guidelines.\n\n## 📄 License\n\nThis package is open-source software licensed under the [MIT License](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrok-php%2Flaravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrok-php%2Flaravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrok-php%2Flaravel/lists"}