{"id":17700617,"url":"https://github.com/stephenjude/laravel-wallet","last_synced_at":"2025-04-04T10:09:14.926Z","repository":{"id":39919650,"uuid":"490765883","full_name":"stephenjude/laravel-wallet","owner":"stephenjude","description":"A simple wallet implementation for Laravel.","archived":false,"fork":false,"pushed_at":"2024-04-04T07:51:24.000Z","size":62,"stargazers_count":251,"open_issues_count":1,"forks_count":21,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-04-13T22:49:51.956Z","etag":null,"topics":["laravel","wallet"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephenjude.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"stephenjude"}},"created_at":"2022-05-10T15:53:59.000Z","updated_at":"2024-04-07T04:29:01.000Z","dependencies_parsed_at":"2024-03-18T22:01:30.379Z","dependency_job_id":"e9ded3c9-4363-464d-ba7f-173a564c2280","html_url":"https://github.com/stephenjude/laravel-wallet","commit_stats":{"total_commits":41,"total_committers":6,"mean_commits":6.833333333333333,"dds":0.6829268292682926,"last_synced_commit":"4ddc628b8505b0cf4a48a55dfac7d857b0fea132"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Flaravel-wallet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Flaravel-wallet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Flaravel-wallet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephenjude%2Flaravel-wallet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephenjude","download_url":"https://codeload.github.com/stephenjude/laravel-wallet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157283,"owners_count":20893220,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","wallet"],"created_at":"2024-10-24T17:42:40.161Z","updated_at":"2025-04-04T10:09:14.887Z","avatar_url":"https://github.com/stephenjude.png","language":"PHP","funding_links":["https://github.com/sponsors/stephenjude"],"categories":[],"sub_categories":[],"readme":"# Laravel Wallet\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/stephenjude/laravel-wallet.svg?style=flat-square)](https://packagist.org/packages/stephenjude/laravel-wallet)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/stephenjude/laravel-wallet/run-tests.yml?label=tests)](https://github.com/stephenjude/laravel-wallet/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/stephenjude/laravel-wallet/php-cs-fixer.yml?label=code%20style)](https://github.com/stephenjude/laravel-wallet/actions?query=workflow%3A\"Check+%26+fix+styling\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/stephenjude/laravel-wallet.svg?style=flat-square)](https://packagist.org/packages/stephenjude/laravel-wallet)\n\nA simple wallet implementation for Laravel.\n\n## Learn More\n- [A Simple Wallet Implementation for Laravel - Laravel News](https://laravel-news.com/laravel-wallet)\n- [Interfaces and Traits: How to Use Them in Laravel Packages - Laravel Daily](https://www.youtube.com/watch?v=s2vF84rSaEA)\n- [Laravel Virtual Wallet with Coupons: 3 Packages Demo - Laravel Daily](https://www.youtube.com/watch?v=Rgu7iEpXRFM\u0026t=44s)\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require stephenjude/laravel-wallet\n```\n\nYou can publish and run the migrations with:\n\n```bash\nphp artisan vendor:publish --tag=\"wallet-migrations\"\nphp artisan migrate\n```\n\n[//]: # ()\n\n[//]: # (```bash)\n\n[//]: # (php artisan vendor:publish --tag=\"wallet-config\")\n\n[//]: # (```)\n\n## Usage\n\n### Prepare User Model\n\n```php\n\nuse Stephenjude\\Wallet\\Interfaces\\Wallet;\nuse Stephenjude\\Wallet\\Traits\\HasWallet;\n\nclass User extends Authenticatable implements Wallet\n{\n    use HasWallet;\n}\n```\n\n### Deposit\n\n```php\n$user = User::first();\n\n$user-\u003edeposit(200.22); // returns the wallet balance: 200.22\n\n$user-\u003edeposit(200); // returns the wallet balance: 400.22\n```\n\n### Withdraw\n```php\n$user-\u003ewithdraw(200); // returns the wallet balance: 200.22\n\n$user-\u003ewithdraw(0.22); // returns the wallet balance: 200\n```\n\n### Balance\n\n```php\n$user-\u003ebalance\n\n$user-\u003ewallet_balance\n```\n\n### Exceptions\n#### InvalidAmountException\nThe `InvalidAmountException` is thrown whenever the deposit or withdrawal amount is a negative numeric value or zero.\n\n#### InsufficientFundException\nThe `InsufficientFundException` is thrown whenever the withdrawal amount is less than the user's wallet balance.\n\n### Alternative Package\nIf you are looking for somthing much bigger and elaborate checkout [Bavix Laravel Wallet](https://bavix.github.io/laravel-wallet/#/).\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [stephenjude](https://github.com/stephenjude)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenjude%2Flaravel-wallet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephenjude%2Flaravel-wallet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephenjude%2Flaravel-wallet/lists"}