PHPackages                             saifalbd/model-collection - 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. saifalbd/model-collection

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

saifalbd/model-collection
=========================

convert php array to object like Laravel Model

v1.0(6y ago)16MitPHPPHP ^7.1

Since Jul 21Pushed 6y agoCompare

[ Source](https://github.com/saifalbd/model-collection)[ Packagist](https://packagist.org/packages/saifalbd/model-collection)[ RSS](/packages/saifalbd-model-collection/feed)WikiDiscussions master Synced today

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

PHP Custom Model Collection
===========================

[](#php-custom-model-collection)

if you can want convert array to object or Multidimensional Arrays To Collection like laravel Eloquent Collection Then this Package Need for you . you can also call object like Associative Arrays object-&gt;key or object\['key'\]

Getting Started
---------------

[](#getting-started)

```
use Saifalbd\CustomModel\Model;

```

### Model Create

[](#model-create)

#### on non-static method

[](#on-non-static-method)

```
$model = new Model();
$data = $model->add(array("name"=>"John", "email"=>"john@gmail.com", "age"=>33));

```

return object you can access $data\["name"\] or $data-&gt;name #####you can also add multiple

```
$collection = $model->add()->add()->add()->get()

```

return object collection you can access $collection\[index\]-&gt;property;

#### on static method

[](#on-static-method)

```
$data = Model::make(array("name"=>"John", "email"=>"john@gmail.com", "age"=>33));

```

return object you can access $data\["name"\] or $data-&gt;name

### Collection Create

[](#collection-create)

#### on non-static method

[](#on-non-static-method-1)

```
$model = new Model();
$collection = $model->addAll(
array("name"=>"Ram", "email"=>"ram@gmail.com", "age"=>23),
    array("name"=>"Shyam", "email"=>"shyam23@gmail.com", "age"=>28),
    array("name"=>"John", "email"=>"john@gmail.com", "age"=>33),
    array("name"=>"Bob", "email"=>"bob32@gmail.com", "age"=>41)
);

```

return object collection you can access $collection\[index\]-&gt;property;

#### on static method

[](#on-static-method-1)

```

$collection = Model::makeAll(
array("name"=>"Ram", "email"=>"ram@gmail.com", "age"=>23),
    array("name"=>"Shyam", "email"=>"shyam23@gmail.com", "age"=>28),
    array("name"=>"John", "email"=>"john@gmail.com", "age"=>33),
    array("name"=>"Bob", "email"=>"bob32@gmail.com", "age"=>41)
);

```

return object collection you can access $collection\[index\]-&gt;property;

note: if you can use this package for laravel project then call $collection-&gt;collection(); return Illuminate\\Support\\Collection

#### model set

[](#model-set)

```
$model = new Model();
$model->country = 'bangladesh'

```

#### model get

[](#model-get)

```
$model->country;
or
$model['country'];

```

#### collection in json

[](#collection-in-json)

```
$model = new Model();
$json = $model->addAll(MultidimensionalArray)->toJson();
or
$json = Model::makeAll(MultidimensionalArray)->toJson();

```

### INSTALL

[](#install)

```
composer require saifalbd/model-collection

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2486d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8fd01a1c295c71d281dfa4abb97069f7089f1cbc44c1639c9b939cb56d3d18d7?d=identicon)[saifalwebs](/maintainers/saifalwebs)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/saifalbd-model-collection/health.svg)

```
[![Health](https://phpackages.com/badges/saifalbd-model-collection/health.svg)](https://phpackages.com/packages/saifalbd-model-collection)
```

###  Alternatives

[mgallegos/laravel-jqgrid

Laravel jqGrid package allows you to easily integrate the popular jQuery Grid Plugin (jqGrid) into your Laravel application.

7115.5k1](/packages/mgallegos-laravel-jqgrid)[lifeonscreen/nova-sort-relations

This package improves support for sorting relations in Laravel Nova.

2081.9k](/packages/lifeonscreen-nova-sort-relations)

PHPackages © 2026

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