PHPackages                             brain-nucleus/client - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. brain-nucleus/client

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

brain-nucleus/client
====================

Official Brain Nucleus event client for Laravel and standalone PHP applications

v1.2.0(4mo ago)02.5k—0%MITPHPPHP ^8.1

Since Dec 22Pushed 4mo agoCompare

[ Source](https://github.com/iamjasonhill/brain-client)[ Packagist](https://packagist.org/packages/brain-nucleus/client)[ Docs](https://github.com/iamjasonhill/brain-client)[ RSS](/packages/brain-nucleus-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

Brain Nucleus Client for Laravel
================================

[](#brain-nucleus-client-for-laravel)

Official client for sending events to Brain Nucleus from Laravel applications.

🚀 Quick Start
-------------

[](#-quick-start)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require brain-nucleus/client:dev-main
```

> **Note:** First-time install? Add the repository to `composer.json`:
>
> ```
> {
>     "repositories": [
>         {
>             "type": "vcs",
>             "url": "https://github.com/iamjasonhill/thebrain.git"
>         }
>     ]
> }
> ```

### 2. Add Environment Variables

[](#2-add-environment-variables)

```
BRAIN_BASE_URL=https://again.com.au
BRAIN_API_KEY=your-api-key-here
```

> **Need an API key?** Log into [Brain Admin](https://again.com.au/admin) → API Keys → New API Key

### 3. Done! 🎉

[](#3-done-)

That's it. The package auto-registers via Laravel's package discovery.

---

✅ What's Automatic (No Code Required)
-------------------------------------

[](#-whats-automatic-no-code-required)

FeatureDescription**Heartbeat**`health.ping` sent every 5 minutes automatically**Singleton**`BrainEventClient` ready for dependency injection**Command**`php artisan brain:heartbeat` for manual testing---

⚠️ What You Need to Implement
-----------------------------

[](#️-what-you-need-to-implement)

The package handles heartbeats automatically, but you must implement:

1. **Error Exception Handling** → Send `error.exception` events
2. **Queue Failed Job Handling** → Send `queue.failed` events

📋 **See [IMPLEMENTATION-CHECKLIST.md](IMPLEMENTATION-CHECKLIST.md) for complete code examples.**

---

💻 Sending Events
----------------

[](#-sending-events)

Inject `BrainEventClient` anywhere in your application:

```
use Brain\Client\BrainEventClient;

class QuoteController extends Controller
{
    public function store(Request $request, BrainEventClient $brain)
    {
        $quote = Quote::create($request->validated());

        $brain->send('quote.created', [
            'quote_id' => $quote->id,
            'email' => $quote->email,
            'amount' => $quote->total,
        ]);

        return response()->json($quote);
    }
}
```

### Async Events (Fire and Forget)

[](#async-events-fire-and-forget)

For non-blocking events:

```
$brain->sendAsync('page.viewed', [
    'page' => request()->path(),
    'user_id' => auth()->id(),
]);
```

---

⚙️ Configuration (Optional)
---------------------------

[](#️-configuration-optional)

Publish the config file to customise behaviour:

```
php artisan vendor:publish --tag=brain-config
```

**config/brain.php:**

```
return [
    'base_url' => env('BRAIN_BASE_URL'),
    'api_key' => env('BRAIN_API_KEY'),

    'heartbeat' => [
        'enabled' => true,  // Set false to disable auto-heartbeat
        'interval' => 5,    // Minutes between heartbeats
    ],

    // Register site-specific custom events
    'events' => [
        'carrier.rate_received' => 'Rate received from transport carrier',
        'quote.manual_override' => 'Quote manually adjusted by staff',
    ],
];
```

---

🔄 Updating the Client
---------------------

[](#-updating-the-client)

```
composer update brain-nucleus/client
```

---

📚 Documentation
---------------

[](#-documentation)

DocumentPurpose[IMPLEMENTATION-CHECKLIST.md](IMPLEMENTATION-CHECKLIST.md)Required implementations (error handling, queue failures)[INTEGRATION-GUIDE.md](INTEGRATION-GUIDE.md)Advanced code patterns and examples[OPS-EVENT-SPEC.md](OPS-EVENT-SPEC.md)Event specifications and fingerprinting[EVENTS.md](EVENTS.md)Business event definitions---

🔗 Quick Links
-------------

[](#-quick-links)

- **Brain Admin:**
- **Health Check:**
- **Repository:**

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance75

Regular maintenance activity

Popularity22

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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 ~0 days

Total

4

Last Release

147d ago

### Community

Maintainers

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

---

Top Contributors

[![iamjasonhill](https://avatars.githubusercontent.com/u/186772261?v=4)](https://github.com/iamjasonhill "iamjasonhill (6 commits)")

---

Tags

laravelmonitoringeventsanalyticsbrainincidents

### Embed Badge

![Health badge](/badges/brain-nucleus-client/health.svg)

```
[![Health](https://phpackages.com/badges/brain-nucleus-client/health.svg)](https://phpackages.com/packages/brain-nucleus-client)
```

###  Alternatives

[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kssadi/log-tracker

A powerful, intuitive, and efficient log viewer for Laravel applications.

264.8k](/packages/kssadi-log-tracker)

PHPackages © 2026

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