joshembling/laragenie
Laragenie is an AI-powered CLI assistant for Laravel. Index your codebase with embeddings, chat from the terminal, ask natural-language questions about your project, and get context-aware answers or code suggestions using OpenAI.
laragenie is an Artisan-driven AI chat assistant that lives inside your Laravel app, so the fastest way to understand it is to install it into a real project and ask it something you'd otherwise grep for.
composer require joshembling/laragenie --dev (keep it in require-dev — it's a developer tool, not a runtime dependency)..env (OPENAI_API_KEY=... by default) before running anything.php artisan laragenie. On first run the package walks you through an interactive install/question flow and publishes config/laragenie.php.Order model's status column defined?"). You're calibrating what context it actually sees, not testing its intelligence.Check php artisan laragenie --help for the current flags (history clearing, output saving) rather than relying on blog posts — options have shifted across 1.x releases.
Treat the config file as project infrastructure. config/laragenie.php controls model, temperature, streaming and the context/exclusion lists. Commit a shared version of it (minus secrets) so every developer gets the same model and the same view of the codebase. Model choice in particular is a team decision, not a personal one — inconsistent models produce inconsistent code review conversations.
Generate-then-review, not generate-then-commit. The productive loop is: ask laragenie for a migration/action/test, paste it into the file yourself, run the test suite, then iterate in the same chat session. Use php artisan make:* for scaffolding you can produce deterministically and reserve the assistant for the parts that actually need judgement.
Scope context per question, not per project. Point the context at the directories relevant to the task (a single domain folder, a service class) instead of the whole app. Smaller context means cheaper requests, faster responses, and less chance the model latches onto an unrelated pattern from a legacy module.
Clear history between topics. Long chat sessions accumulate stale assumptions ("we're using repositories") that silently corrupt later answers. Start a fresh session when you switch from, say, billing to auth.
Pair with tests as the contract. Ask for behaviour ("a test asserting a refund over 30 days is rejected"), let it produce the Pest/PHPUnit file, then let the test — not the model — decide whether the subsequent implementation is correct.
Use it as an exploration aid on unfamiliar code. New joiners get more value from "explain what this middleware does and who registers it" than from "write me a CRUD controller", because the failure mode is recoverable.
config/laragenie.php before the first run in a client repo, and make sure .env, credentials, and proprietary vendor code aren't in the context paths.php artisan config:cache in local dev (some teams do via a deploy script), edits to laragenie.php won't take effect. php artisan config:clear first when a config change appears ignored.vendor/ or the docs.Questions.php to fix a mis-branching path. If you previously got stuck or got the wrong config generated during install, delete the published config and rerun php artisan laragenie on 1.2.2+ rather than hand-patching.composer.json. 1.x has moved quickly; a floating constraint can change default model or prompt behaviour under you mid-sprint.How can I help you explore Laravel packages today?