New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

jenssegers/model

An Laravel eloquent-like model class, for Laravel and other frameworks
4,802,186 393

Larablocks Analysis

Compatibility

Trusted maintainer

jenssegers/model works with Laravel 4 to 12 (latest release v1.5.4, Mar 16, 2025).

  • Trusted maintainer: jenssegers publishes 12 packages on Larablocks, with 2,472,380 downloads a month between them.

Recommendation checks

Use with care

Use with care: meets 2 of 4 checks.

  • Latest release doesn't support Laravel 13, the current version
  • No release in the last 12 months (last: Mar 16, 2025)
  • 61,090 downloads a month (at least 10,000)
  • 393 GitHub stars (at least 100)

State

Quiet
  • Last stable release: Mar 16, 2025.
  • No releases in the last 12 months.
  • First released: Jan 13, 2014.
  • Monthly downloads: 61,090, up 50% from six months ago.
  • 21 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 26, 2026.

Install
composer require jenssegers/model
Latest Version:v1.5.4
Laravel:4 – 12
License:MIT
Last Updated:Mar 16, 2025
Links: GitHub  ·  Packagist
Maintainer: jenssegers

Model

Build Status Coverage Status

This model provides an Laravel eloquent-like base class that can be used to build custom models in Laravel or other frameworks.

Features

  • Accessors and mutators
  • Model to Array and JSON conversion
  • Hidden attributes in Array/JSON conversion
  • Guarded and fillable attributes
  • Appending accessors and mutators to Array/JSON conversion
  • Attribute casting

You can read more about these features and the original Eloquent model on http://laravel.com/docs/eloquent

Installation

Install using composer:

composer require jenssegers/model

Example


use Jenssegers\Model\Model;

class User extends Model {

    protected $hidden = ['password'];

    protected $guarded = ['password'];

    protected $casts = ['age' => 'integer'];

    public function save()
    {
        return API::post('/items', $this->attributes);
    }

    public function setBirthdayAttribute($value)
    {
        $this->attributes['birthday'] = strtotime($value);
    }

    public function getBirthdayAttribute($value)
    {
        return new DateTime("@$value");
    }

    public function getAgeAttribute($value)
    {
        return $this->birthday->diff(new DateTime('now'))->y;
    }
}

$item = new User(array('name' => 'john'));
$item->password = 'bar';

echo $item; // {"name":"john"}

Related Packages

cerbero/eloquent-inspector

Inspect Laravel Eloquent models to collect properties, relationships and more.

57,468 112
czim/laravel-nestedupdater

Eloquent model updater for nested relations data for Laravel.

54,483 19
custom-d/eloquent-model-encrypt

A eloquent model encrypt

6,242
czim/laravel-modelcomparer

Performs a deep-nested comparison of a model's before/after state.

4,738 2
dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

3,631,957 483

Version History

Version Released PHP Laravel License
v1.5.4 ^4.0|^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0 MIT
v1.5.3 ^4.0|^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0 MIT
v1.5.2 ^4.0|^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0 MIT
v1.5.1 ^4.0|^5.0|^6.0|^7.0|^8.0|^9.0|^10.0 MIT
v1.5.0 ^4.0|^5.0|^6.0|^7.0|^8.0|^9.0 MIT