PHPackages                             kduma/coinhive-api - 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. kduma/coinhive-api

AbandonedArchivedLibrary

kduma/coinhive-api
==================

PHP and Laravel 5 CoinHive API and Captcha

v1.1.1(8y ago)102063MITPHPPHP ~7.0

Since Oct 5Pushed 7y ago3 watchersCompare

[ Source](https://github.com/kduma-OSS/LV-CoinHive-api)[ Packagist](https://packagist.org/packages/kduma/coinhive-api)[ Docs](https://github.com/kduma-OSS/L5-CoinHiveApi)[ RSS](/packages/kduma-coinhive-api/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Package EOL
===========

[](#package-eol)

This package is archived because of [discontinuation of CoinHive](https://coinhive.com/blog/en/discontinuation-of-coinhive).

PHP and Laravel 5 CoinHive API and Captcha
==========================================

[](#php-and-laravel-5-coinhive-api-and-captcha)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7a21659d2de397ac69e22c4cc5bc7fc6a6dacc0e0f6a9f3d9018f01f8f60c3f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b64756d612f636f696e686976652d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kduma/coinhive-api)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/c2f3574ffcc2bc5ef4ef451c4ca2624d83cfc5a2070531e346298ae22a79d3e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b64756d612f636f696e686976652d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kduma/coinhive-api)

PHP and Laravel 5 CoinHive API and Captcha

Install
-------

[](#install)

Via Composer

```
$ composer require kduma/coinhive-api
```

Usage
-----

[](#usage)

```
$api = new \KDuma\CoinHive\CoinHiveApi(YOUR_SITE_KEY, YOUR_SECRET_KEY);

$api->getPayoutStats();
$api->getSiteStats();
$api->withdrawFromUser($name, $amount);
$api->getUserBalance($name);
$api->getTopUsers($count = 128);
$api->getUsersList($page = null, $count = 4096);
$api->createLink($url, $hashes = 256);
$api->resetUser($name);
$api->resetAllUsers();
$api->verifyToken($token, $hashes = 256);
```

Laravel Usage
-------------

[](#laravel-usage)

### Setup

[](#setup)

In Laravel 5.5, service provider is automatically discovered. If you don't use package discovery, add the Service Provider to the providers array in `config/app.php`:

```
KDuma\CoinHive\Laravel\CoinHiveServiceProvider::class,

```

Add following entries to your `.env` file:

```
COINHIVE_SITE_KEY=
COINHIVE_SECRET_KEY=
COINHIVE_DEFAULT_HASHES_COUNT=512

```

Add following entries to your `config\services.php` file:

```
'coinhive' => [
    'default_hashes' => env('COINHIVE_DEFAULT_HASHES_COUNT', 512),
    'site_key' => env('COINHIVE_SITE_KEY'),
    'secret_key' => env('COINHIVE_SECRET_KEY'),
    'use_authedmine_url' => true,
],

```

### Usage

[](#usage-1)

You can resolve `CoinHiveApi::class` class:

```
use KDuma\CoinHive\CoinHiveApi;

$api = app(CoinHiveApi::class);

$top_users = $api->getTopUsers();
```

or You can use injection container

```
use KDuma\CoinHive\CoinHiveApi;

Route::get('/api', function (CoinHiveApi $api) {
    $top_users = $api->getTopUsers();
});
```

### Using [CoinHive Proof of Work Captcha](https://coinhive.com/documentation/captcha) with Laravel

[](#using-coinhive-proof-of-work-captcha-with-laravel)

In your form, place Captcha field using `CoinHiveCaptchaDisplayer` class:

```
{!! resolve(\KDuma\CoinHive\CoinHiveCaptchaDisplayer::class)->display() !!}
```

You can also specify more options like `required_hashes`, `autostart`, `whitelabel` or `disable-elements`like the following example:

```
{!! resolve(\KDuma\CoinHive\CoinHiveCaptchaDisplayer::class)->display(256, [
    'data-autostart' => false,
    'data-whitelabel' => false,
    'data-disable-elements' => "#submit",
]) !!}
```

To check if the Captcha is valid you can use `ValidateCoinHiveCaptchaToken` validator:

```
Route::post('/post', function (\Illuminate\Http\Request $request) {
    $request->validate([
        'coinhive-captcha-token' => new \KDuma\CoinHive\Laravel\ValidateCoinHiveCaptchaToken()
    ]);
});
```

If you need custom `required_hashes` number, you can pass it in the constructor.

Credits
-------

[](#credits)

- [Krystian Duma](https://github.com/kduma)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~54 days

Total

3

Last Release

3029d ago

### Community

Maintainers

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

---

Top Contributors

[![kduma](https://avatars.githubusercontent.com/u/1062582?v=4)](https://github.com/kduma "kduma (9 commits)")

---

Tags

laravelphplaravelKDumacoinhive

### Embed Badge

![Health badge](/badges/kduma-coinhive-api/health.svg)

```
[![Health](https://phpackages.com/badges/kduma-coinhive-api/health.svg)](https://phpackages.com/packages/kduma-coinhive-api)
```

###  Alternatives

[rtconner/laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a 'like' or 'favorite' or 'remember' feature.

394388.0k5](/packages/rtconner-laravel-likeable)[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)[aschmelyun/cleaver

A blazing-fast static site generator using Laravel's Blade templating engine

2961.0k](/packages/aschmelyun-cleaver)[zoxta/nova-cloudflare-card

Purge your CloudFlare's cache in two clicks from a Laravel Nova dashboard card.

105.7k](/packages/zoxta-nova-cloudflare-card)

PHPackages © 2026

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