npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kidkender/archmind-laravel-parser

v0.4.2

Published

Static analysis parser for Laravel projects — extracts routes, middleware chains, FormRequest validation rules, and auth patterns into ArchMind IR graphs.

Readme

@kidkender/archmind-laravel-parser

Static analysis parser for Laravel projects — part of the ArchMind ecosystem.

Reads your Laravel PHP source code and produces two things:

  1. IR execution graphs — one per HTTP route, capturing middleware chains, auth checks, service calls, and transaction patterns
  2. FormRequest schemas — field-level validation rules extracted from FormRequest::rules() methods

Uses tree-sitter-php for accurate PHP AST parsing. No PHP runtime required.


Installation

npm install @kidkender/archmind-laravel-parser

Usage

Parse FormRequest validation rules

import { parseFormRequests } from "@kidkender/archmind-laravel-parser"
import type { DTOSchema } from "@kidkender/archmind-protocol"

const { schemas, index } = parseFormRequests("/path/to/laravel-project")

// index.get("CreateUserRequest")
// → {
//     className: "CreateUserRequest",
//     file: "app/Http/Requests/CreateUserRequest.php",
//     fields: [
//       { name: "email", type: "string", rules: [{ kind: "required" }, { kind: "email" }] },
//       { name: "age",   type: "number", rules: [{ kind: "required" }, { kind: "integer" }, { kind: "min", value: 18 }] },
//       { name: "role",  type: "string", rules: [{ kind: "required" }, { kind: "isIn", value: ["admin", "user"] }] },
//     ]
//   }

Parse a single FormRequest file

import { parseFormRequestFile } from "@kidkender/archmind-laravel-parser"

const content = readFileSync("app/Http/Requests/CreateUserRequest.php", "utf-8")
const schemas = parseFormRequestFile(content, "app/Http/Requests/CreateUserRequest.php")

Parse routes → IR graphs (advanced)

import { parseRouteFile, augmentGraph, parseKernel } from "@kidkender/archmind-laravel-parser"

// Low-level: parse a single route file
const skeletonGraphs = parseRouteFile("/path/to/project/routes/api.php", { projectRoot })

// Enrich with middleware, policies, services, transactions
const aliasMap = parseKernel("/path/to/project/app/Http/Kernel.php")
const graphs   = await augmentGraph(skeletonGraphs, { projectRoot, aliasMap })

FormRequest rule mapping

Supports both pipe syntax and array syntax:

// Pipe syntax
'email' => 'required|email|max:255'

// Array syntax
'email' => ['required', 'email', 'max:255']

| Laravel rule | Rule emitted | Notes | |-------------|-------------|-------| | required | required | | | nullable / sometimes | optional | | | string | (infers type) | Sets field type to string | | integer / numeric | integer / (infers type) | Sets field type to number | | boolean | boolean | | | array | array | | | email | email | | | url | url | | | uuid | uuid | | | date | date | | | alpha_num | alphanumeric | | | min:N | minLength (string) or min (numeric) | Depends on field type | | max:N | maxLength (string) or max (numeric) | Depends on field type | | between:min,max | minLength+maxLength or min+max | | | in:a,b,c | isIn with values array | | | regex:/pattern/ | regex | |


What route parsing extracts

| What | How detected | |------|-------------| | HTTP method + path | Route::get, Route::post, Route::apiResource, etc. | | Middleware groups | ->middleware(['auth', 'throttle:60,1']) | | Middleware aliases | Resolved from Kernel.php $middlewareAliases | | Controller actions | FQCN resolution via composer.json PSR-4 autoload map | | Invokable controllers | Route::post('/path', MyController::class) | | FormRequest classes | @Body param type annotation in controller | | Policy checks | $this->authorize('update', $model) calls | | Transaction boundaries | DB::transaction(function() { ... }) | | Tenant scope | Detects queries with and without forTenant() / where('tenant_id') |


Output types

All output types are from @kidkender/archmind-protocol:

import type {
  IntermediateExecutionGraph,
  ExecutionNode,
  DTOSchema,
  FieldSchema,
  ValidationRule,
} from "@kidkender/archmind-protocol"

Requirements

  • Node.js 18+
  • Laravel project with FormRequest classes (for validation extraction)

License

MIT