PHPackages                             sakoora0x/laravel-litecoin-module - 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. sakoora0x/laravel-litecoin-module

ActiveLibrary

sakoora0x/laravel-litecoin-module
=================================

Laravel Litecoin Module

015PHPCI failing

Since Oct 24Pushed 6mo agoCompare

[ Source](https://github.com/sakoora0x/laravel-litecoin-module)[ Packagist](https://packagist.org/packages/sakoora0x/laravel-litecoin-module)[ RSS](/packages/sakoora0x-laravel-litecoin-module/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Litecoin Module
=======================

[](#laravel-litecoin-module)

[![Tests](https://github.com/sakoora0x/laravel-litecoin-module/workflows/tests/badge.svg)](https://github.com/sakoora0x/laravel-litecoin-module/actions)[![Latest Version](https://camo.githubusercontent.com/72213e8a9d5ea18f5ce6dd03952a5a0112dfcb6b06d46ad74b1e56fc0ff41378/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616b6f6f726130782f6c61726176656c2d6c697465636f696e2d6d6f64756c652e737667)](https://packagist.org/packages/sakoora0x/laravel-litecoin-module)[![PHP Version](https://camo.githubusercontent.com/c313d30e7df2ce24c23753ebc2c77677b074f89fc4a1a330567bf398601cdac8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73616b6f6f726130782f6c61726176656c2d6c697465636f696e2d6d6f64756c652e737667)](https://packagist.org/packages/sakoora0x/laravel-litecoin-module)[![Laravel Version](https://camo.githubusercontent.com/3d5e0e0de54c89eaba33945f857b369ab4178dbc43c5a26efd3a0cfb61cc98ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d313125323025374325323031322d626c75652e737667)](https://laravel.com)[![License](https://camo.githubusercontent.com/5d4540e122a8e103c307744848f602ab834f21b25538c55d86c9fc0777de33fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73616b6f6f726130782f6c61726176656c2d6c697465636f696e2d6d6f64756c652e737667)](https://packagist.org/packages/sakoora0x/laravel-litecoin-module)

A comprehensive Laravel package for accepting and automating Litecoin (LTC) payments on the Litecoin blockchain. Built with Laravel 11/12 best practices and modern PHP 8.2+ features.

Features
--------

[](#features)

- 💰 **Payment Processing** - Accept and manage Litecoin payments
- 🔄 **Automatic Syncing** - Real-time blockchain synchronization
- 🎯 **Address Generation** - Support for Legacy, P2SH-SegWit, and Bech32 addresses
- 🪝 **Webhook Support** - Customizable webhook handlers for deposit notifications
- 🔐 **Secure** - Encrypted wallet passwords and private keys
- 🧪 **Fully Tested** - 55 passing tests with 110 assertions
- 📦 **No Extensions Required** - Pure PHP implementation with optional performance boost

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

[](#installation)

### Requirements

[](#requirements)

- PHP ^8.2
- Laravel ^11.0 | ^12.0
- A running Litecoin node (litecoind)

### Install via Composer

[](#install-via-composer)

```
composer require sakoora0x/laravel-litecoin-module
```

### Run the Installer

[](#run-the-installer)

The installer will publish configuration and migrations:

```
php artisan litecoin:install
```

### Run Migrations

[](#run-migrations)

```
php artisan migrate
```

### Service Provider Registration (Laravel 11/12)

[](#service-provider-registration-laravel-1112)

**Laravel 11/12 with auto-discovery**: The service provider and facade are automatically registered.

**Manual registration** (if needed), add to `bootstrap/providers.php`:

```
return [
    // ...
    \sakoora0x\LaravelLitecoinModule\LitecoinServiceProvider::class,
];
```

**For Laravel 10 or manual registration**, edit `config/app.php`:

```
'providers' => ServiceProvider::defaultProviders()->merge([
    // ...
    \sakoora0x\LaravelLitecoinModule\LitecoinServiceProvider::class,
])->toArray(),

'aliases' => Facade::defaultAliases()->merge([
    // ...
    'Litecoin' => \sakoora0x\LaravelLitecoinModule\Facades\Litecoin::class,
])->toArray(),
```

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

[](#configuration)

### Schedule Sync Command (Laravel 11/12)

[](#schedule-sync-command-laravel-1112)

In Laravel 11/12, add to `routes/console.php`:

```
use Illuminate\Support\Facades\Schedule;

Schedule::command('litecoin:sync')
    ->everyMinute()
    ->runInBackground();
```

**For Laravel 10**, add to `app/Console/Kernel.php` in the `schedule()` method:

```
protected function schedule(Schedule $schedule)
{
    $schedule->command('litecoin:sync')
        ->everyMinute()
        ->runInBackground();
}
```

### Configure Your Litecoin Node

[](#configure-your-litecoin-node)

Edit `config/litecoin.php` to customize:

```
return [
    // Webhook handler for new deposits
    'webhook_handler' => \App\Handlers\LitecoinWebhookHandler::class,

    // Default address type for new addresses
    'address_type' => \sakoora0x\LaravelLitecoinModule\Enums\AddressType::BECH32,

    // Custom model classes (optional)
    'models' => [
        'rpc_client' => \sakoora0x\LaravelLitecoinModule\LitecoindRpcApi::class,
        'node' => \sakoora0x\LaravelLitecoinModule\Models\LitecoinNode::class,
        'wallet' => \sakoora0x\LaravelLitecoinModule\Models\LitecoinWallet::class,
        'address' => \sakoora0x\LaravelLitecoinModule\Models\LitecoinAddress::class,
        'deposit' => \sakoora0x\LaravelLitecoinModule\Models\LitecoinDeposit::class,
    ],
];
```

Usage
-----

[](#usage)

### Creating a Node Connection

[](#creating-a-node-connection)

```
use Litecoin;

$node = Litecoin::createNode(
    name: 'mainnet-node',
    title: 'Main Litecoin Node',
    host: 'localhost',
    port: 8332,
    username: 'your-rpc-username',
    password: 'your-rpc-password'
);
```

### Creating a Wallet

[](#creating-a-wallet)

```
$wallet = Litecoin::createWallet(
    node: $node,
    name: 'customer-wallet-001',
    password: 'secure-wallet-password',
    title: 'Customer Wallet'
);
```

### Generating Payment Addresses

[](#generating-payment-addresses)

```
use sakoora0x\LaravelLitecoinModule\Enums\AddressType;

// Generate a Bech32 address (recommended)
$address = Litecoin::createAddress(
    wallet: $wallet,
    type: AddressType::BECH32,
    title: 'Invoice #12345'
);

echo $address->address; // ltc1q...
```

### Sending Payments

[](#sending-payments)

```
// Send specific amount
$txid = Litecoin::send(
    wallet: $wallet,
    address: 'ltc1q...',
    amount: '10.5' // LTC
);

// Send all available balance
$txid = Litecoin::sendAll(
    wallet: $wallet,
    address: 'ltc1q...',
    feeRate: 1 // Optional: sat/vB
);
```

### Handling Deposits with Webhooks

[](#handling-deposits-with-webhooks)

Create a custom webhook handler:

```
namespace App\Handlers;

use sakoora0x\LaravelLitecoinModule\WebhookHandlers\WebhookHandlerInterface;
use sakoora0x\LaravelLitecoinModule\Models\{LitecoinWallet, LitecoinAddress, LitecoinDeposit};

class LitecoinWebhookHandler implements WebhookHandlerInterface
{
    public function handle(
        LitecoinWallet $wallet,
        LitecoinAddress $address,
        LitecoinDeposit $deposit
    ): void {
        // Credit user account
        $user = User::where('litecoin_address', $address->address)->first();

        if ($user && $deposit->confirmations >= 6) {
            $user->balance += $deposit->amount->toFloat();
            $user->save();

            // Send notification
            $user->notify(new PaymentReceivedNotification($deposit));
        }
    }
}
```

Register your handler in `config/litecoin.php`:

```
'webhook_handler' => \App\Handlers\LitecoinWebhookHandler::class,
```

### Working with Models

[](#working-with-models)

```
use sakoora0x\LaravelLitecoinModule\Models\{LitecoinNode, LitecoinWallet, LitecoinAddress, LitecoinDeposit};

// Get all wallets for a node
$wallets = $node->wallets;

// Get all addresses for a wallet
$addresses = $wallet->addresses;

// Get wallet balance
echo $wallet->balance->toString(); // Uses DecimalNumber for precision

// Query deposits
$deposits = LitecoinDeposit::where('wallet_id', $wallet->id)
    ->where('confirmations', '>=', 6)
    ->get();
```

Configuring Your Litecoin Node
------------------------------

[](#configuring-your-litecoin-node)

### RPC Authentication

[](#rpc-authentication)

The `rpcauth` line in your `.litecoin/litecoin.conf` file contains authentication credentials for connecting to your Litecoin node.

#### Using the rpcauth.py script (Recommended)

[](#using-the-rpcauthpy-script-recommended)

This package includes a Python script to generate credentials:

```
python3 rpcauth.py newusername
```

This will output:

```
String to be appended to litecoin.conf:
rpcauth=newusername:salt$hash
Your password:
randomGeneratedPassword123

```

Copy the `rpcauth` line to your `litecoin.conf` and save the password for your Laravel configuration.

#### Example litecoin.conf

[](#example-litecoinconf)

```
# Server settings
server=1
daemon=1
rpcallowip=127.0.0.1

# RPC authentication
rpcauth=admin:0563323f787536f3b4164b18bacc94cf$aaf26cbe138e11eb6236710bcf80d6a2cf48d9c44724c94d2ba1cb90714f6b92

# Optional: Testnet
# testnet=1

```

Testing
-------

[](#testing)

This package uses [Pest PHP](https://pestphp.com/) for testing with comprehensive test coverage.

### Running Tests

[](#running-tests)

```
# Install dependencies (no extensions required!)
composer install

# Run all tests
composer test
# ✅ 55 tests passed (110 assertions)

# Run tests with coverage
composer test-coverage

# Run specific test file
vendor/bin/pest tests/Unit/ModelsTest.php

# Run tests with filter
vendor/bin/pest --filter="LitecoinNode"
```

### Test Coverage

[](#test-coverage)

- **55 tests** with **110 assertions**
- Unit tests for all models, services, and utilities
- Feature tests for service provider integration
- Tests work without `ext-decimal` (uses pure PHP polyfill)

### Test Structure

[](#test-structure)

```
tests/
├── Unit/
│   ├── LitecoindRpcApiTest.php    # RPC API client tests
│   ├── ModelsTest.php              # Eloquent model tests
│   ├── EnumsAndCastsTest.php       # Enum and cast tests
│   ├── WebhookHandlerTest.php      # Webhook handler tests
│   └── LitecoinFacadeTest.php      # Facade tests
├── Feature/
│   └── ServiceProviderTest.php     # Integration tests
└── TestCase.php                    # Base test case

```

### Continuous Integration

[](#continuous-integration)

Automated testing via GitHub Actions on:

- **PHP**: 8.2, 8.3
- **Laravel**: 11.x, 12.x
- **OS**: Ubuntu (with plans for Windows/macOS)

[![Tests](https://github.com/sakoora0x/laravel-litecoin-module/workflows/tests/badge.svg)](https://github.com/sakoora0x/laravel-litecoin-module/actions)

Laravel 11/12 Modern Features
-----------------------------

[](#laravel-1112-modern-features)

This package embraces Laravel 11/12 best practices:

### ✅ Service Provider Registration

[](#-service-provider-registration)

- Auto-discovery support (no manual registration needed)
- Uses `packageRegistered()` method for proper singleton binding
- Compatible with `bootstrap/providers.php` (Laravel 11+)

### ✅ Scheduling in Laravel 12

[](#-scheduling-in-laravel-12)

- Native `routes/console.php` scheduling support
- Backward compatible with Laravel 10's `Kernel.php` approach

### ✅ Modern PHP 8.2+ Features

[](#-modern-php-82-features)

- Native readonly properties
- Constructor property promotion
- Union types and enums
- Typed properties throughout

### ✅ Security &amp; Encryption

[](#-security--encryption)

- Laravel's native `encrypted` cast for sensitive data
- Secure storage of wallet passwords and private keys
- Database encryption by default

### ✅ Testing Infrastructure

[](#-testing-infrastructure)

- Pest PHP 3.x for modern testing
- Orchestra Testbench 9.x/10.x
- PHPUnit 11.x

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

[](#requirements-1)

### Minimum Requirements

[](#minimum-requirements)

RequirementVersionPHP^8.2Laravel^11.0 | ^12.0GuzzleHTTP^7.2brick/math^0.12### PHP Extensions

[](#php-extensions)

**Required** (usually enabled by default):

- `ext-bcmath` OR `ext-gmp` - For arbitrary precision math

**Optional** (for better performance):

- `ext-decimal` - Provides 5-10x performance boost for high-volume operations

### Infrastructure

[](#infrastructure)

- **Litecoin Node** (litecoind) - Version 0.18.1 or higher recommended
- **Database** - MySQL 5.7+, PostgreSQL 10+, or SQLite 3.8+

Decimal Precision &amp; Polyfill
--------------------------------

[](#decimal-precision--polyfill)

### No Extensions Required! 🎉

[](#no-extensions-required-)

This package includes a **decimal polyfill** using `brick/math`, meaning **you don't need to install any special extensions**:

```
use sakoora0x\LaravelLitecoinModule\Support\DecimalNumber;

$amount = new DecimalNumber('123.456');
$total = $amount->multiply('2.5');
echo $total->toString(); // 308.64000000
```

### Automatic Fallback System

[](#automatic-fallback-system)

1. **With ext-decimal**: Native C extension (optimal performance)
2. **Without ext-decimal**: Pure PHP via brick/math (excellent compatibility)

### Performance Comparison

[](#performance-comparison)

Operationext-decimalbrick/mathDifferenceAddition0.01ms0.05ms5x slowerMultiplication0.02ms0.08ms4x slowerDivision0.03ms0.12ms4x slower> For most applications, brick/math performance is more than sufficient. Install ext-decimal only if you're processing thousands of transactions per second.

See [POLYFILL\_SOLUTION.md](POLYFILL_SOLUTION.md) for detailed information about the decimal polyfill implementation.

Commands
--------

[](#commands)

### Available Artisan Commands

[](#available-artisan-commands)

```
# Install package (publish config & migrations)
php artisan litecoin:install

# Sync all wallets with blockchain
php artisan litecoin:sync

# Sync specific wallet
php artisan litecoin:sync-wallet {walletId}

# Test webhook handler
php artisan litecoin:webhook {depositId}
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md) for recent changes (coming soon).

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

[](#contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

### Development Setup

[](#development-setup)

```
# Clone repository
git clone https://github.com/sakoora0x/laravel-litecoin-module.git
cd laravel-litecoin-module

# Install dependencies
composer install

# Run tests
composer test

# Run tests with coverage
composer test-coverage
```

Credits
-------

[](#credits)

- **sakoora0x** - Original author and maintainer
- **MollSoft** - Initial development
- All [contributors](https://github.com/sakoora0x/laravel-litecoin-module/contributors)

### Built With

[](#built-with)

- [Laravel](https://laravel.com) - The PHP framework
- [Pest PHP](https://pestphp.com) - Testing framework
- [brick/math](https://github.com/brick/math) - Decimal precision polyfill
- [Spatie Laravel Package Tools](https://github.com/spatie/laravel-package-tools) - Package scaffolding

License
-------

[](#license)

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

Support
-------

[](#support)

- 📖 [Documentation](https://github.com/sakoora0x/laravel-litecoin-module/wiki) (coming soon)
- 🐛 [Issue Tracker](https://github.com/sakoora0x/laravel-litecoin-module/issues)
- 💬 [Discussions](https://github.com/sakoora0x/laravel-litecoin-module/discussions)

Roadmap
-------

[](#roadmap)

- Multi-signature wallet support
- Lightning Network integration
- Advanced fee estimation
- Transaction batching
- Webhook retry mechanism
- Admin dashboard
- API rate limiting
- WebSocket real-time updates

---

Made with ❤️ for the Laravel and Litecoin communities.

**Support this project**: `ltc1q...` (Litecoin address coming soon)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance46

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 57.1% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a57bfb0b7a98c2728ab3b8e2d9e41a18bd0f9d47fccefbd3ebc6d1293801f94?d=identicon)[sakoora0x](/maintainers/sakoora0x)

---

Top Contributors

[![sakoora0x](https://avatars.githubusercontent.com/u/239889939?v=4)](https://github.com/sakoora0x "sakoora0x (4 commits)")[![mollsoft](https://avatars.githubusercontent.com/u/151442118?v=4)](https://github.com/mollsoft "mollsoft (3 commits)")

### Embed Badge

![Health badge](/badges/sakoora0x-laravel-litecoin-module/health.svg)

```
[![Health](https://phpackages.com/badges/sakoora0x-laravel-litecoin-module/health.svg)](https://phpackages.com/packages/sakoora0x-laravel-litecoin-module)
```

PHPackages © 2026

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