PHPackages                             basanta/array-model - 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. basanta/array-model

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

basanta/array-model
===================

A package to handle array data as a model in Laravel.

1.1.0(1mo ago)09PHPPHP ^8.0

Since Apr 13Pushed 1mo agoCompare

[ Source](https://github.com/basantashubhu/array-model)[ Packagist](https://packagist.org/packages/basanta/array-model)[ RSS](/packages/basanta-array-model/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

Array Model
===========

[](#array-model)

`basanta/array-model` is a lightweight Laravel-friendly library that lets you treat in-memory arrays like model records with collection-style querying and bulk operations.

It is useful when you want model-like behavior without a database layer.

Features
--------

[](#features)

- Define simple model classes backed by arrays
- Create records with model-like syntax
- Query records with `where()` and multi-condition filtering
- Define model relationships (`hasMany`, `hasOne`, `belongsTo`)
- Lazy load relationships on first property access or in bulk with `load()`
- Bulk update filtered results
- Delete filtered results from the in-memory store
- Convert model store to plain arrays
- Built on top of Laravel Collection APIs

Requirements
------------

[](#requirements)

- PHP `^8.0`
- Laravel Framework `>=10.0`

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

[](#installation)

Install via Composer:

```
composer require basanta/array-model
```

Quick Start
-----------

[](#quick-start)

Create a model class by extending `Basanta\ArrayModel\ArrayModel`:

```
