PHPackages                             titasgailius/larastan-extended - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. titasgailius/larastan-extended

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

titasgailius/larastan-extended
==============================

An opinionated Larastan extension. Automatically parse model's casts() method.

0.0.2(11mo ago)02.7k—9.1%1MITPHP

Since Jun 5Pushed 11mo agoCompare

[ Source](https://github.com/TitasGailius/larastan-extended)[ Packagist](https://packagist.org/packages/titasgailius/larastan-extended)[ RSS](/packages/titasgailius-larastan-extended/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (3)Used By (0)

 [![Larastan Extended Demo](./screenshots/cover.jpeg)](./screenshots/cover.jpeg)

Larastan Extended
=================

[](#larastan-extended)

Larastan Extended is an opinionated Larastan extension that inspects your Laravel application to make static analysis less verbose.

Features
========

[](#features)

Automatically infer the return type of the casts method.
--------------------------------------------------------

[](#automatically-infer-the-return-type-of-the-casts-method)

```
/**
 * Get the attributes that should be cast.
- *
- * @return array{
- *     user_id: 'integer',
- *     published_at: 'datetime',
- * }
 */
public function casts(): array
{
    return [
        'user_id' => 'integer',
        'published_at' => 'datetime',
    ];
}
```

Detect non-nullable $request-&gt;user() calls in authenticated routes.
----------------------------------------------------------------------

[](#detect-non-nullable-request-user-calls-in-authenticated-routes)

```
Route::get('posts', function (Request $request) {
-    /** @var \App\Models\User */
-    $user = $request->user();
-
-    return $user->posts;
+    return $request->user()->posts;
})->middleware('auth');
```

Detect non-nullable relationships.
----------------------------------

[](#detect-non-nullable-relationships)

```
Route::get('teams/{team}/owner', function (Team $team) {
-  /** @var \App\Models\User */
-  $owner = $team->owner;
-
-  return $owner;
+  return $team->owner;
});
```

Installation
============

[](#installation)

You can install the package via Composer:

```
composer require --dev titasgailius/larastan-extended
```

Usage
=====

[](#usage)

Include the extension **before** the Larastan extension.

```
includes:
+ - vendor/titasgailius/larastan-extended/extension.neon
  - vendor/larastan/larastan/extension.neon
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance51

Moderate activity, may be stable

Popularity24

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

Every ~4 days

Total

2

Last Release

343d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12625773?v=4)[Titas Gailius](/maintainers/TitasGailius)[@TitasGailius](https://github.com/TitasGailius)

---

Top Contributors

[![TitasGailius](https://avatars.githubusercontent.com/u/12625773?v=4)](https://github.com/TitasGailius "TitasGailius (5 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/titasgailius-larastan-extended/health.svg)

```
[![Health](https://phpackages.com/badges/titasgailius-larastan-extended/health.svg)](https://phpackages.com/packages/titasgailius-larastan-extended)
```

###  Alternatives

[ticketswap/phpstan-error-formatter

A minimalistic error formatter for PHPStan

87578.8k35](/packages/ticketswap-phpstan-error-formatter)[ramsey/devtools

A Composer plugin to aid PHP library and application development.

7134.7k26](/packages/ramsey-devtools)[johnbillion/wp-compat

PHPStan extension to help verify that your PHP code is compatible with a given version of WordPress

24115.0k10](/packages/johnbillion-wp-compat)

PHPackages © 2026

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