PHPackages                             drahil/socraites - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. drahil/socraites

ActiveLibrary

drahil/socraites
================

v0.1.0(7mo ago)012MITPHP

Since Aug 10Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/drahil/Socraites)[ Packagist](https://packagist.org/packages/drahil/socraites)[ RSS](/packages/drahil-socraites/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (4)Used By (0)

Socraites – AI-Powered Code Review Tool for Laravel
===================================================

[](#socraites--ai-powered-code-review-tool-for-laravel)

An intelligent Laravel-specific CLI tool that performs AI-assisted code reviews by analyzing your staged Git changes and their surrounding code context.

> ⚠️ For development environments only
> 📦 PostgreSQL is required
> 🧱 Laravel-only support

✨ Features
----------

[](#-features)

```
🧠 AI-Powered Reviews: Get actionable, context-aware code feedback using OpenAI

🛠️ Built for Laravel: Tailored to Laravel conventions and structure

📁 Function-Level Chunking: Your codebase is automatically broken down and vectorized by method/function

🔍 Persistent Vector Context: Code context is stored in PostgreSQL for efficient retrieval

⚙️ Fully Configurable: Customize OpenAI model, temperature, max context size, etc.

✅ Simple Artisan Workflow: Setup and review your codebase with familiar Artisan commands

```

📦 Installation
--------------

[](#-installation)

Install the package in development only:

```
composer require --dev drahil/socraites
```

Publish the config and migration files:

```
php artisan vendor:publish --provider="drahil\Socraites\Providers\SocraitesServiceProvider"
```

Run the migration to create the code\_chunks table (PostgreSQL only):

```
php artisan migrate
```

🚀 Usage
-------

[](#-usage)

1. Setup Socraites

    This interactive command configures your environment and generates .socraites.json:

    ```
    php artisan socraites:setup
    ```

    It collects and stores:

    ```
    {
      "maximum_context_size": 10000,
      "ignore_patterns": ["tests/", "vendor/"],
      "extensions": [".php"],
      "openai_model": "gpt-4",
      "openai_temperature": 0.2,
      "question_prompt": "Perform a detailed code review"
    }
    ```
2. Vectorize Your Codebase

    This command chunks your codebase by functions/methods and stores vectors in the `code_chunks` table:

    ```
    php artisan socraites:vectorize
    ```
3. Perform Code Review

    After staging your changes via git add, run the review: Analyze your staged changes and surrounding context:

    ```
    php artisan socraites:code-review
    ```

🧾 Example Output
----------------

[](#-example-output)

```
Analyzing your code...

"Wisdom begins in wonder."
- Socrates

  SOCRAITES CODE REVIEW

  ✅ Overall Summary:
  ────────────────────────────────────────────────────────────
     The changes in 'src/Entity/User.php' aim to define a new User class that implements the UserInterface from Symfony's Security component. However, the methods required by the interface are declared but not implemented, which will lead to issues during runtime if the class is used.
  ────────────────────────────────────────────────────────────

  📁 Files from context:
  ────────────────────────────────────────────────────────────
     src/Entity/User.php
  ────────────────────────────────────────────────────────────

  🔍 Reviewing: src/Entity/User.php
  ────────────────────────────────────────────────────────────
  ✅ Summary:
     Implementation of the User class which implements the UserInterface from Symfony Security.
  ❌ Major Issues:
     Unimplemented methods required by the UserInterface.
  ⚠️  Minor Issues:
     Missing newline at end of file.
  💡 Suggestions:
     Implement the methods 'getRoles', 'eraseCredentials', and 'getUserIdentifier' to fulfill the contract of the UserInterface.
     Add a newline at the end of the file to follow good coding standards.
  ────────────────────────────────────────────────────────────

  💬 Suggested Commit Message:
  ────────────────────────────────────────────────────────────
     Add User class skeleton implementing UserInterface
  ────────────────────────────────────────────────────────────
   Do you have a question about the code review? [no]:
   >
```

After the code review output, Socraites offers an optional interactive prompt.

You can type a custom question (e.g., "*Why is this considered a major issue?*" or "*How can I improve this method further?*"), and Socraites will generate a detailed AI response based on the review context.

### 📦 PHP Dependencies

[](#-php-dependencies)

*(Automatically installed via Composer)*

- `PHP` ^8.0
- `nikic/php-parser` ^5.4 *(Code analysis)*
- `symfony/console` ^7.2 *(CLI interface)*
- `symfony/process` ^7.2 *(Git command execution)*
- `guzzlehttp/guzzle` ^7.0 *(OpenAI API communication)*

📃 License
---------

[](#-license)

Socraites is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance62

Regular maintenance activity

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

235d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3fe676c2eb5272dfe2bf724385b703f1ce35bd056c716839cd63ddf9b60f22d?d=identicon)[drahil](/maintainers/drahil)

---

Top Contributors

[![drahil](https://avatars.githubusercontent.com/u/74052766?v=4)](https://github.com/drahil "drahil (55 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/drahil-socraites/health.svg)

```
[![Health](https://phpackages.com/badges/drahil-socraites/health.svg)](https://phpackages.com/packages/drahil-socraites)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.7k509.9M17.0k](/packages/laravel-framework)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
