PHPackages                             joydeep-bhowmik/laravel-point-vault - 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. [Database &amp; ORM](/categories/database)
4. /
5. joydeep-bhowmik/laravel-point-vault

ActiveLibrary[Database &amp; ORM](/categories/database)

joydeep-bhowmik/laravel-point-vault
===================================

A Laravel point management system to manage point transactions within Eloquent models

v1.0.0(1y ago)04MITPHPPHP ^8.0

Since Sep 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/joydeep-bhowmik/laravel-point-vault)[ Packagist](https://packagist.org/packages/joydeep-bhowmik/laravel-point-vault)[ RSS](/packages/joydeep-bhowmik-laravel-point-vault/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Point Vault Documentation
=================================

[](#laravel-point-vault-documentation)

Introduction
------------

[](#introduction)

**Laravel Point Vault** provides a flexible points system for your Laravel models. This package allows models to have a "points vault" where you can easily debit and credit points, keep track of balances, and record transactions.

This documentation will guide you through the installation, configuration, and usage of the package.

---

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

[](#requirements)

- Laravel version: `^8.0` or higher
- PHP version: `^7.4` or higher

---

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

[](#installation)

To install the package, use Composer:

```
composer require joydeep-bhowmik/laravel-point-vault
```

### Register the Service Provider

[](#register-the-service-provider)

You need to register the package's service provider. If you're using **Laravel 5.5** or later, this is automatically handled by the framework’s package auto-discovery feature.

If you are using an earlier version of Laravel or if you’ve disabled auto-discovery, manually add the service provider to the `config/app.php` file:

```
'providers' => [
    JoydeepBhowmik\LaravelPointVault\Providers\LaravelPointVaultServiceProvider::class,
],
```

### Migrations

[](#migrations)

After registering the service provider, run the package's migrations to create the necessary database table for point transactions.

```
php artisan migrate
```

---

Configuration
-------------

[](#configuration)

You may want to publish the migration file (if needed) to make modifications before running migrations:

```
php artisan vendor:publish --provider="JoydeepBhowmik\LaravelPointVault\Providers\LaravelPointVaultServiceProvider" --tag="migrations"
```

---

Usage
-----

[](#usage)

### Applying the `HasPoints` Trait

[](#applying-the-haspoints-trait)

To use the points system, add the `HasPoints` trait to any Eloquent model where you want to manage points. This trait adds functionality for crediting, debiting, and checking balances.

Example:

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use JoydeepBhowmik\LaravelPointVault\Traits\HasPoints;

class User extends Model
{
    use HasPoints;
}
```

### Methods Provided by the `HasPoints` Trait

[](#methods-provided-by-the-haspoints-trait)

#### `getCurrentBalance()`

[](#getcurrentbalance)

This method returns the current balance of points for the model.

```
$balance = $user->getCurrentBalance();
echo $balance; // Outputs the user's current point balance
```

#### `credit($amount, $note = null)`

[](#creditamount-note--null)

This method credits a specified amount of points to the model.

```
$user->credit(100, 'Initial bonus');
```

#### `debit($amount, $note = null)`

[](#debitamount-note--null)

This method debits a specified amount of points from the model's balance.

```
$user->debit(50, 'Purchase item');
```

> **Note:** The debit operation checks whether the user has sufficient points before performing the transaction. If there are insufficient points, an exception will be thrown.

#### `points()`

[](#points)

This method defines the polymorphic relationship between the model and the `Point` model. You can use it to access all the point transactions for a model.

```
$transactions = $user->points;
```

### Custom Point Transaction Logic

[](#custom-point-transaction-logic)

If you want to customize how points are credited or debited, you can extend the provided methods or interact with the `Point` model directly.

---

Database Structure
------------------

[](#database-structure)

The package expects a `points` table with the following columns:

- `id`: Primary key
- `pointable_id`: The ID of the model that owns the points (polymorphic relation)
- `pointable_type`: The type of the model that owns the points (polymorphic relation)
- `amount`: The number of points being credited or debited
- `transaction_type`: Either 'CREDIT' or 'DEBIT'
- `note`: An optional note for the transaction
- `created_at` / `updated_at`: Timestamps for when the transaction occurred

---

Events
------

[](#events)

You may also hook into Laravel's event system if you wish to listen for point transactions. Although not explicitly included in the provided code, you could easily dispatch events within the `makeTransaction` method for more complex scenarios.

---

License
-------

[](#license)

This package is open-source software licensed under the [MIT license](https://github.com/joydeep-bhowmik/laravel-point-vault/blob/main/LICENSE).

---

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

592d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/339f473176adf5ccfb998d976e96084e1c4e0ca4af3817242576670074f431c4?d=identicon)[joydeep-bhowmik](/maintainers/joydeep-bhowmik)

---

Top Contributors

[![joydeep-bhowmik](https://avatars.githubusercontent.com/u/45948068?v=4)](https://github.com/joydeep-bhowmik "joydeep-bhowmik (6 commits)")

---

Tags

laravellaravel point management systemlaravel point vault

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/joydeep-bhowmik-laravel-point-vault/health.svg)

```
[![Health](https://phpackages.com/badges/joydeep-bhowmik-laravel-point-vault/health.svg)](https://phpackages.com/packages/joydeep-bhowmik-laravel-point-vault)
```

###  Alternatives

[tpetry/laravel-postgresql-enhanced

Support for many missing PostgreSQL specific features

9982.0M14](/packages/tpetry-laravel-postgresql-enhanced)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[biiiiiigmonster/hasin

Laravel framework relation has in implement

154552.4k](/packages/biiiiiigmonster-hasin)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[bavix/laravel-clickhouse

Eloquent model for ClickHouse

72214.1k2](/packages/bavix-laravel-clickhouse)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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