Analyze Laravel Projects with Introspect
July 1, 2025Analyze Laravel Codebases with Laravel Introspect
If you’re doing a complex refactor or building dev tools, Laravel Introspect helps you query your app code—views, models, routes, classes—using a type-safe fluent API.
Main Features
- Fluent queries for views, routes, classes, and models.
- Wildcard support (e.g.
components.*.button). - Parse Eloquent model properties, relationships, casts.
- Serialize/deserialize queries as JSON (great for LLM tools).
Usage Examples
use Mateffy\Introspect\Facades\Introspect;
// Find views used by certain pages
$views = Introspect::views()
->whereNameEquals('components.*.button')
->whereUsedBy('pages.admin.*')
->get();
// Query routes using auth middleware and POST method
$routes = Introspect::routes()
->whereUsesMiddleware('auth')
->whereUsesMethod('POST')
->get();
// Extract model schema or JSON Schema
$detail = Introspect::model(User::class);
$schema = $detail->schema();
Check it out on GitHub: capevace/laravel-introspect.
Blog
Jun 29, 2025
How OAuth Works OAuth is a protocol that allows third-party applications to access user data without sharing passwords. It's the backbone of secure a...
Aug 09, 2025
Object-Oriented Programming (OOP) is a modern software development approach that divides an application into units called Objects that interact with...
Jul 06, 2025
Using Web Components the Smart Way A lot of developers assume Web Components are meant to replace full SPA frameworks like React or Vue. But in rea...
Aug 17, 2025
Laravel Global Scopes: Automatic Query Filtering Eloquent Importance: Enforce consistent filters across all model queries (e.g., Soft Del...
Jul 01, 2025
🚫 Stop Copy-Pasting Code! Ever duplicated slug logic or logging across multiple models? Laravel's Traits got your back. 1. What’s a Trait?...
Jun 26, 2025
CSS Specificity: Cascade Layers vs BEM vs Utility Classes This article compares three approaches to managing CSS specificity — BEM, utility‑f...