PHPackages                             echowine/laravel-orm-ao - 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. echowine/laravel-orm-ao

ActiveLibrary

echowine/laravel-orm-ao
=======================

08PHP

Since Feb 10Pushed 9y ago1 watchersCompare

[ Source](https://github.com/EchoWine/laravel-orm-ao)[ Packagist](https://packagist.org/packages/echowine/laravel-orm-ao)[ RSS](/packages/echowine-laravel-orm-ao/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel ORM - Attribute as an Object
====================================

[](#laravel-orm---attribute-as-an-object)

Treat your attributes as they deserve, as objects!

Installation
------------

[](#installation)

Modify your composer.json and run `composer update`

```
{
    "require": {
        "echowine/laravel-orm-ao":"@dev"
    }
}
```

Defining a Model
----------------

[](#defining-a-model)

```
namespace CoreWine\ORM\Test\Model;

use CoreWine\ORM\Model;
use CoreWine\ORM\AttributesBuilder;

class User extends Model{

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'tests_users';

    /**
     * List of all your attributes.
     *
     * @param AttributesBuilder $builder
     *
     * @return void
     */
    protected function attributes(AttributesBuilder $builder){

    	$builder -> string('username')
    		-> minLength(3)
    		-> maxLength(10)
    		-> match("/^([a-zA-Z0-9])*$/");

    	$builder -> boolean('active');

        $builder -> number('points') -> range(0,99);
    }

}
```

Boolean
-------

[](#boolean)

Starting with the easiest one, only two values accepted (true,false)

```
    $user = User::first();
    $user -> active = "true"; // true
    $user -> active = "false"; // false
    $user -> active = true; // true
    $user -> active = 1; // true
```

Number
------

[](#number)

```
    $user = User::first();
    $user -> points = 10;
```

\###Methods

MethodDescriptionrange(int $min, int $max)Minimum and maximum at oncemin(int $min)Minimum valuemax(int $max)Maximum value\###Exceptions

ExceptionDescriptionCoreWine\\ORM\\Field\\Number\\Exceptions\\TooSmallExceptionThe value is too smallCoreWine\\ORM\\Field\\Number\\Exceptions\\TooBigExceptionThe value is too bigString
------

[](#string)

Thanks to magic methods editing the value of an attribute remains the same

```
    $user = User::first();
    $user -> username = "Admin";
    $user -> save();
```

But i told you, attributes are objects!

```
    $user -> username -> toLowerCase(); // "admin"
    $user -> username -> length(); // 5
```

\###Methods

MethodDescriptionmatch(string|closure $match)A regular expression or a closure that define the correct valueminLength(int $min)Minimum lengthmaxLength(int $max)Maximum length\###Exceptions

ExceptionDescriptionCoreWine\\ORM\\Field\\Number\\Exceptions\\TooShortExceptionThe value is too shortCoreWine\\ORM\\Field\\Number\\Exceptions\\TooLongExceptionThe value is too longCoreWine\\ORM\\Field\\Number\\Exceptions\\InvalidExceptionThe value doesn't match with the regex/closureThe string field is currently using Stringy\\Stringy, check all methods available here [danielstjules/Stringy](https://github.com/danielstjules/Stringy)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

---

Top Contributors

[![EchoWine](https://avatars.githubusercontent.com/u/16058223?v=4)](https://github.com/EchoWine "EchoWine (30 commits)")

---

Tags

larvelphp

### Embed Badge

![Health badge](/badges/echowine-laravel-orm-ao/health.svg)

```
[![Health](https://phpackages.com/badges/echowine-laravel-orm-ao/health.svg)](https://phpackages.com/packages/echowine-laravel-orm-ao)
```

PHPackages © 2026

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