• Reading time ~ 1 min
  • 11.02.2024

Laragenie is an AI chatbot with an Artisan console integration for your Laravel applications. It can understand your source code by indexing directory/file paths. You can then ask questions about your code such as "Describe all the model associations for the App\Models\Post model".

Here's an example of how you can configure the indexes in your configuration file. It works by indexing your configured files with an AI model using OpenAI to generate responses and Pinecone to index data:

// config/laragenie.php
return [
    // ...
    'indexes' => [
        'directories' => ['App/Models', 'App/Http/Controllers'],
        'files' => ['tests/Feature/MyTest.php'],
        'removal' => [
            'strict' => true,
        ],
    ],
];

Once you’ve installed this package, you can index your files, clear the index, and ask questions by running the laragenie command:

The Laragenie AI prompt
Ask questions about your code from the command line.

Note that the files you index and ask questions about needn’t be only PHP files! You can also index and ask questions about your JavaScript, GitHub workflows, etc. The neat thing about this CLI is that it’s not generic answers; it’s specifically helpful to answer questions about your unique codebases.

Using AI models is a valuable way to speed up tedious tasks. It can be helpful in onboarding developers new to a project and getting general knowledge about an unfamiliar codebase more rapidly.

This package is available on Github at joshembling/laragenie and installable via composer:

composer require --dev joshembling/laragenie

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297