PHPackages                             ivanaquino/laravel-credithub - 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. ivanaquino/laravel-credithub

ActiveLibrary

ivanaquino/laravel-credithub
============================

This is my package laravel-credithub

0.1.0(1y ago)07[4 PRs](https://github.com/IvanAquino/laravel-credithub/pulls)MITPHPPHP ^8.2CI passing

Since Aug 24Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/IvanAquino/laravel-credithub)[ Packagist](https://packagist.org/packages/ivanaquino/laravel-credithub)[ Docs](https://github.com/ivanaquino/laravel-credithub)[ GitHub Sponsors](https://github.com/IvanAquino)[ RSS](/packages/ivanaquino-laravel-credithub/feed)WikiDiscussions main Synced 2d ago

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

This is my package laravel-credithub
====================================

[](#this-is-my-package-laravel-credithub)

under development
-----------------

[](#under-development)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0b4da948ff14a090fc6f75e78220ed4d314f9854e5a2265d7bd867024c9d5aef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6976616e617175696e6f2f6c61726176656c2d6372656469746875622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanaquino/laravel-credithub)[![GitHub Tests Action Status](https://camo.githubusercontent.com/8c823f6ce8edeb1fc4ae834b13dd7810036ba3bee7b7804a23b83c60b496e7ca/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6976616e617175696e6f2f6c61726176656c2d6372656469746875622f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ivanaquino/laravel-credithub/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/b077eb151e41d8243d6f561d230ae21a932b883898c0c490fcc747208a8d4918/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6976616e617175696e6f2f6c61726176656c2d6372656469746875622f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/ivanaquino/laravel-credithub/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/8a1e75a512e629904b7b8bb68b247eef21cffd56295775791b228521891194ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6976616e617175696e6f2f6c61726176656c2d6372656469746875622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanaquino/laravel-credithub)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/7b3dcc3199df46d1b8be4be15d33091a52b474da222b269543dc973d19b61783/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d6372656469746875622e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-credithub)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require ivanaquino/laravel-credithub
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="credithub-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="credithub-config"
```

This is the contents of the published config file:

```
return [
    'type_field' => 'string',
];
```

Usage
-----

[](#usage)

You have to implement HasCredits contract in your model and use CreditTransactional trait.

```
// ...
use IvanAquino\LaravelCredithub\Contracts\HasCredits;
use IvanAquino\LaravelCredithub\Traits\CreditTransactional;

class User extends Model implements HasCredits
{
    use CreditTransactional;
}
// ...
```

Now you can use the following methods:

```
$user = User::find(1);
# Add credits
$user->addCredits(100);
$user->addCredits(100, 'Bonus');
$user->addCredits(100, 'Bonus', ['my_custom_field' => 'my_custom_value']);
# Subtract credits
$user->subtractCredits(100);
$user->subtractCredits(100, 'Withdraw');
$user->subtractCredits(100, 'Withdraw', ['my_custom_field' => 'my_custom_value']);
# Transfer credits
$user->transferCreditsTo(100, $anotherUser);
$user->transferCreditsTo(100, $anotherUser, 'Transfer');
$user->transferCreditsTo(100, $anotherUser, 'Transfer', ['my_custom_field' => 'my_custom_value']);

# Get credits
$user->credit_balance; // integer
$user->has_credits; // true or false
```

You can cast type field of CreditTransaction model to whatever type you want, example:

```
return [
    'type_field' => \App\Enums\CreditTransactionType::class,
];
```

```
use \App\Enums\CreditTransactionType;

$user = User::find(1);
# Add credits
$user->addCredits(100, CreditTransactionType::BONUS);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ivan Aquino](https://github.com/IvanAquino)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance63

Regular maintenance activity

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

679d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29342852?v=4)[Ivan Aquino](/maintainers/IvanAquino)[@IvanAquino](https://github.com/IvanAquino)

---

Top Contributors

[![IvanAquino](https://avatars.githubusercontent.com/u/29342852?v=4)](https://github.com/IvanAquino "IvanAquino (7 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

laravelIvanAquinolaravel-credithub

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ivanaquino-laravel-credithub/health.svg)

```
[![Health](https://phpackages.com/badges/ivanaquino-laravel-credithub/health.svg)](https://phpackages.com/packages/ivanaquino-laravel-credithub)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.8k3](/packages/defstudio-telegraph)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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