Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

laravel-fluent

> 编程语言
Open source

Laravel Fluent The package provides an expressive "fluent" way to define model attributes. It automatically builds casts at the runtime and…

559 stars0 likes0 views
WebsiteGitHub

About

Laravel Fluent The package provides an expressive "fluent" way to define model attributes. It automatically builds casts at the runtime and…

Laravel Fluent

The package provides an expressive "fluent" way to define model attributes. It automatically builds casts at the runtime and adds a native autocompletion to the models' properties.

Introduction

With laravel-fluent, you can define Model attributes as you would do with any other class. The values will be transformed to the corresponding types depending on the native types of the properties.

Before:

php
 'collection',
        'price' => 'float',
        'available' => 'integer',
    ];
}

After:

php
hasMany(Feature::class);
    }

    public function category(): BelongsTo
    {
        return $this->belongsTo(Category::class);
    }
}

Relations method declaration is still required for proper autocompletion. However, the package can automatically resolve relations from attributes.

php
<?php

class Product extends Model
{
    use Fluent;

    #[HasMany(Feature::class)]
    public Collection $features;
    #[BelongsTo]
    public Category $category;
}

Testing

bash
composer test

Todo

  • Migration generator

Credits

  • Boris Lepikhin
  • All Contributors

License

The MIT License (MIT). Please see License File for more information.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHP

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言