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(1y ago)06.5k↓41.8%1MITPHP

Since Jun 5Pushed 1y 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 2w 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

28

—

LowBetter than 51% of packages

Maintenance44

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

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

435d 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

[deptrac/deptrac

Deptrac is a static code analysis tool that helps to enforce rules for dependencies between software layers.

3.0k9.8M297](/packages/deptrac-deptrac)[phpstan/phpstan-doctrine

Doctrine extensions for PHPStan

67475.0M1.6k](/packages/phpstan-phpstan-doctrine)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136411.0k14](/packages/rector-rector-src)[ticketswap/phpstan-error-formatter

A minimalistic error formatter for PHPStan

87766.6k61](/packages/ticketswap-phpstan-error-formatter)[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

39255.4k37](/packages/ec-europa-toolkit)[worksome/coding-style

Worksomes coding style

49826.1k69](/packages/worksome-coding-style)

PHPackages © 2026

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