PHPackages                             binarycabin/brainblocks - 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. [Payment Processing](/categories/payments)
4. /
5. binarycabin/brainblocks

ActiveLibrary[Payment Processing](/categories/payments)

binarycabin/brainblocks
=======================

An integration helper for taking Nano payments via BrainBlocks

1.4.3(7y ago)01372MITHTML

Since May 26Pushed 7y agoCompare

[ Source](https://github.com/binarycabin/brainblocks)[ Packagist](https://packagist.org/packages/binarycabin/brainblocks)[ RSS](/packages/binarycabin-brainblocks/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (1)Versions (9)Used By (0)

BrainBlocks for Laravel
=======================

[](#brainblocks-for-laravel)

An integration helper for taking Nano payments via BrainBlocks.io

This package adds a few helpers when adding a BrainBlocks button with Laravel

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

[](#installation)

```
composer require binarycabin/brainblocks

```

In .env, add your Nano wallet address the button will send to:

```
BRAINBLOCKS_RECEIVE_ADDRESS=nano_1999...

```

Adding Buttons
--------------

[](#adding-buttons)

Simply include the button view where you would like the button to appear. Be sure to include the amount (in rai) that the button will take as well as the url the button will POST to with a valid brainblocks token:

```
@include('brainblocks::button',['amount'=>1000,'action'=>url('/pay')])

```

You can add multiple buttons on this page using this include. Then at the bottom of the page, be sure to add your javascript

```
@include('brainblocks::scripts')

```

Validating BrainBlocks Responses
--------------------------------

[](#validating-brainblocks-responses)

In your POST route, call the

```
Route::post('/pay', function(Request $request){
    $brainBlocksResponse = \BrainBlocks::getTokenResponse($request->brainblocks_token);
    $responseIsValid = \BrainBlocks::validateResponse($brainBlocksResponse,[
        'amount_rai' => 200,
    ]);
    dump($brainBlocksResponse);
    if($responseIsValid){
    	//.. do successful stuff
    }
});

```

`BrainBlocks::getTokenResponse` will return the full response from the BrainBlocks, this can be validated manually or you can use the `validateResponse` helper.

By default, the `validateResponse` helper will make sure:

- the `fulfilled` property is `true`
- the "destination" address matches the address your config The second property takes an array of additional validations you would like to check, for example checking the amount.

Custom Currencies
-----------------

[](#custom-currencies)

In addition to the default "rai", you can change the currency used to any of the supported currencies listed on [brainblocks.io](https://brainblocks.io)

```
@include('brainblocks::button',['amount'=>5,'currency'=>'usd','action'=>url('/pay')])

```

Be sure to update your validator to look for the correct currency and amount

```
$responseIsValid = \BrainBlocks::validateResponse($brainBlocksResponse,[
	'amount' => 5,
	'currency' => 'usd',
]);

```

Custom Destination
------------------

[](#custom-destination)

If you need a specific button to go to a destination address other than the one set in your configuration, you can add it as an option as well

```
@include('brainblocks::button',['amount'=>1000,'destination'=>'nano_11223344...','action'=>url('/pay')])

```

Be sure to update your validator to look for the changed destination instead of the default

```
$responseIsValid = \BrainBlocks::validateResponse($brainBlocksResponse,[
	'amount_rai' => 1000,
	'destination' => 'xrb_1kojnrrw8rtybqsqk5uh7bcioo8thkiqjkibmn43togd416gzfye6j44b9sc',
]);

```

Donate
------

[](#donate)

[![Donate with NaNote](https://camo.githubusercontent.com/d7afa55fc23fee88285750ac407d7794f2c1bdd22067da75b862bced5688603f/68747470733a2f2f692e696d6775722e636f6d2f614c6f707457412e706e67)](https://nanote.net/pay/binarycabin)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 93.8% 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 ~27 days

Total

8

Last Release

2716d ago

### Community

Maintainers

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

---

Top Contributors

[![kilrizzy](https://avatars.githubusercontent.com/u/132478?v=4)](https://github.com/kilrizzy "kilrizzy (15 commits)")[![nicolas-t](https://avatars.githubusercontent.com/u/1765930?v=4)](https://github.com/nicolas-t "nicolas-t (1 commits)")

### Embed Badge

![Health badge](/badges/binarycabin-brainblocks/health.svg)

```
[![Health](https://phpackages.com/badges/binarycabin-brainblocks/health.svg)](https://phpackages.com/packages/binarycabin-brainblocks)
```

###  Alternatives

[chargebee/chargebee-php

ChargeBee API client implementation for PHP

768.0M9](/packages/chargebee-chargebee-php)[imdhemy/google-play-billing

Google Play Billing

491.3M5](/packages/imdhemy-google-play-billing)[bitpay/sdk

Complete version of the PHP library for the new cryptographically secure BitPay API

42337.5k4](/packages/bitpay-sdk)[buckaroo/sdk

Buckaroo payment SDK

12189.1k9](/packages/buckaroo-sdk)[contica/facturador-electronico-cr

Un facturador de código libre para integrar facturación electrónica en Costa Rica a un proyecto PHP

2128.8k](/packages/contica-facturador-electronico-cr)[karson/mpesa-php-sdk

172.2k](/packages/karson-mpesa-php-sdk)

PHPackages © 2026

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