PHPackages                             medicivn/core - 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. medicivn/core

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

medicivn/core
=============

v1.1.7(3y ago)07.5k1[4 issues](https://github.com/MediciVN/core/issues)MITPHPPHP ^8.1

Since Jul 5Pushed 3y ago3 watchersCompare

[ Source](https://github.com/MediciVN/core)[ Packagist](https://packagist.org/packages/medicivn/core)[ RSS](/packages/medicivn-core/feed)WikiDiscussions 1.1.x Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (18)Used By (0)

Medici Core
===========

[](#medici-core)

Medici core package

- Repository, Pipeline
- NodesTree
- [EloquentNestedSet](#EloquentNestedSet)
    - [warning](#warning)
- ApiResponser
- StatusCode, Error Handler
- [Helpers](#Helpers)

Helpers
-------

[](#helpers)

Add `MediciCoreHelperServiceProvider` to `config/app.php`, example:

```
    'providers' => [
        ...
        MediciVN\Core\Providers\MediciCoreHelperServiceProvider::class,
    ],

```

Functions:

- upload\_images
- resize\_image
- upload\_private\_images
- get\_url\_private
- medici\_logger
- generate\_random\_verification\_code
- upload\_image\_v2
- upload\_private\_image\_v2

### Upload Image

[](#upload-image)

- Upload an image

```
    $disk = Storage::disk(env('FILESYSTEM_CLOUD_PRIVATE', 's3')); // disk driver instance
    $uploader = new Uploader($source, $disk, $path); // uploader instance
    $uploader->setSizes($size); // resize image if required
    $uploader->setFileName($fileName); // want to set a specific file name
    $uploader->upload()->getResult(); // upload and get result

    // or you can chain the methods in one line
    $uploader->setSizes($size)->setFileName($fileName)->upload()->getResult();

    // global function
    upload_image_v2($source, $path, $size, $fileName);
```

EloquentNestedSet
-----------------

[](#eloquentnestedset)

Automatically update the tree when creating, updating and deleting a node.

How to use:

- First, a root node must be initialized in your model's table
- Add `use EloquentNestedSet;` to your eloquent model, example:

```
class Category extends Model
{
    use EloquentNestedSet;

    /**
     * The root node id
     * Default: 1
     */
    const ROOT_ID = 99999;

    /**
     * The left position column name
     * Default: 'lft'
     *
     * Note: 'lft' can be a negative number
     */
    const LEFT = 'lft';

    /**
     * The right position column name
     * Default: 'rgt'
     *
     * Note: 'rgt' can be a negative number
     */
    const RIGHT = 'rgt';

    /**
     * The parent's id column name
     * Default: 'parent_id'
     */
    const PARENT_ID = 'parent_id';

    /**
     * The depth column name
     * The depth of a node - nth descendant, it doesn't affect left and right calculation
     * Starting from the root node will have a depth of 0
     * Default: 'depth'
     */
    const DEPTH = 'depth';

    /**
     * The queue connection is declared in your project `config/queue.php`.
     * if QUEUE_CONNECTION and QUEUE are not provided, lft and rgt calculation are synchronized.
     *
     * Default: null
     */
    const QUEUE_CONNECTION = 'sqs';

    /**
     * Default: null
     */
    const QUEUE = 'your_queue';

```

### Functions

[](#functions)

- `getTree`: get all nodes and return as `nested array`
- `getFlatTree`: get all nodes and return as `flatten array`, the child nodes will be sorted after the parent node
- `getAncestors`: get all `ancestor` nodes of current instance
- `getAncestorsTree`: get all `ancestor` nodes of current instance and return as `nested array`
- `getDescendants`: get all `descendant` nodes of current instance
- `getDescendantsTree`: get all `descendant` nodes of current instance and return as `nested array`
- `parent`: get the parent node to which the current instance belongs
- `children`: get the child nodes of the current instance
- `getLeafNodes`: get all leaf nodes - nodes with no children

#### Other

[](#other)

- `buildNestedTree`: build a nested tree base on `parent_id`

### Query scopes

[](#query-scopes)

[Laravel Eloquent Query Scopes](https://laravel.com/docs/9.x/eloquent#query-scopes)

The `root` node is automatically ignored by a global scope of `ignore_root`. To get the `root` node, use `withoutGlobalScope('ignore_root')`.

- `ancestors`
- `descendants`
- `flattenTree`
- `leafNodes`

### Warning

[](#warning)

- If you are using `SoftDelete` and intend to stop using it, you must deal with soft deleted records. The tree will be shuffled, and the calculation of lft and rgt may go wrong.
- `SoftDelete` is required if you use `queue`. Because the `queue` will not run in `deleting` and `deleted` events if a record is permanently deleted.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~9 days

Recently: every ~20 days

Total

17

Last Release

1270d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/da1372656502f411426e810d1cd2a39c27e725fe3566c3d6d6c4e5d1d909fa6f?d=identicon)[duyngha](/maintainers/duyngha)

![](https://www.gravatar.com/avatar/82cf8224a32b96dbba4b0454806058ad5a4a418580f9ada2949b0454ad8ffbd2?d=identicon)[medicivn](/maintainers/medicivn)

---

Top Contributors

[![duyngha](https://avatars.githubusercontent.com/u/8712540?v=4)](https://github.com/duyngha "duyngha (38 commits)")[![MediciVN](https://avatars.githubusercontent.com/u/107663288?v=4)](https://github.com/MediciVN "MediciVN (28 commits)")[![linhnc-medici](https://avatars.githubusercontent.com/u/105692913?v=4)](https://github.com/linhnc-medici "linhnc-medici (20 commits)")[![hoangTuan1996](https://avatars.githubusercontent.com/u/42212101?v=4)](https://github.com/hoangTuan1996 "hoangTuan1996 (4 commits)")[![tolawho](https://avatars.githubusercontent.com/u/12527881?v=4)](https://github.com/tolawho "tolawho (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/medicivn-core/health.svg)

```
[![Health](https://phpackages.com/badges/medicivn-core/health.svg)](https://phpackages.com/packages/medicivn-core)
```

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M339](/packages/yajra-laravel-datatables-oracle)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[beyondcode/laravel-favicon

Create dynamic favicons based on your environment settings.

37345.5k](/packages/beyondcode-laravel-favicon)[laragear/preload

Effortlessly make a Preload script for your Laravel application.

119363.5k](/packages/laragear-preload)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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