PHPackages                             allstak/laravel-sdk - 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. allstak/laravel-sdk

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

allstak/laravel-sdk
===================

Official Laravel SDK for AllStak Observability Platform - Automatic error tracking, performance monitoring, and distributed tracing

1.11(1y ago)050MITPHPPHP &gt;=7.2 &lt;9.0

Since Jan 5Pushed 5mo agoCompare

[ Source](https://github.com/AllStak/Laravel-SDK)[ Packagist](https://packagist.org/packages/allstak/laravel-sdk)[ RSS](/packages/allstak-laravel-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (10)Used By (0)

AllStak Laravel SDK v2.0
========================

[](#allstak-laravel-sdk-v20)

Official Laravel SDK for AllStak Observability Platform - Complete error tracking, performance monitoring, and distributed tracing for Laravel applications. [![Version](https://camo.githubusercontent.com/dd1b51eac051b316a3173585bc64d36e19fa2d4e90a4581734cc292c175130f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d322e302e302d626c75652e737667)](CHANGELOG.md)[![PHP](https://camo.githubusercontent.com/ae7056fd1ef456f7d1b5baf10f4e4254d118d3d2e3f54f0955815a840d749459/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344372e342d707572706c652e737667)](composer.json)[![Laravel](https://camo.githubusercontent.com/cf0faef059bc4ff4a385bfa530f22371158317f1efbef8b1be2ee992907d5ea8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e302d2d31322e302d7265642e737667)](composer.json)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE.md)

✨ Features
----------

[](#-features)

### Automatic Monitoring (Zero Code Required!)

[](#automatic-monitoring-zero-code-required)

- ✅ **HTTP Request Tracking** - All requests/responses with full context
- ✅ **Error &amp; Exception Capture** - Stack traces, context, user info
- ✅ **Database Query Monitoring** - SQL queries with execution time
- ✅ **Application Logging** - All Laravel logs automatically captured
- ✅ **Distributed Tracing** - OpenTelemetry-compliant trace propagation

### Manual Instrumentation

[](#manual-instrumentation)

- 📊 **Custom Spans** - Monitor performance of any operation
- 🔍 **Custom Logging** - Log with rich context and attributes
- ⚡ **Error Reporting** - Report handled errors with context
- 🎯 **Query Tracking** - Track custom database operations

### Performance &amp; Privacy

[](#performance--privacy)

- 🚀 **Event Batching** - Efficient batching with compression (70-80% reduction)
- 🔐 **Privacy Controls** - IP anonymization, header scrubbing
- ⚙️ **Sampling** - Control data volume and costs
- 🎛️ **Path Exclusion** - Exclude health checks and metrics

📦 Quick Start
-------------

[](#-quick-start)

### 1. Install

[](#1-install)

```
composer require allstak/laravel-sdk
```

### 2. Publish Configuration

[](#2-publish-configuration)

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

### 3. Configure Environment

[](#3-configure-environment)

Add to your `.env`:

```
ALLSTAK_API_KEY=your-api-key-here
ALLSTAK_PROJECT_ID=your-project-uuid
ALLSTAK_ENV=production
```

### 4. Start Monitoring! 🎉

[](#4-start-monitoring-)

**That's it!** AllStak now automatically monitors:

- All HTTP requests and responses
- All exceptions and errors
- All database queries
- All application logs

🚀 Usage
-------

[](#-usage)

### Automatic Monitoring

[](#automatic-monitoring)

No code needed! Once configured, AllStak automatically captures everything.

### Manual Instrumentation

[](#manual-instrumentation-1)

```
use AllStak\Facades\AllStak;
// Log anything
AllStak::log('info', 'User logged in', [
    'user_id' => auth()->id(),
    'timestamp' => now()->toDateTimeString(),
]);
// Track errors
try {
    $this->riskyOperation();
} catch (\Exception $e) {
    AllStak::captureError($e, request(), [
        'handled' => true,
        'operation' => 'riskyOperation',
    ]);
}
// Monitor performance
$span = AllStak::startSpan('payment_processing');
$result = $this->processPayment($order);
$span['attributes']['order_id'] = $order->id;
AllStak::endSpan($span, 'OK');
// Force immediate send
AllStak::flush();
```

### Quick Test

[](#quick-test)

```
Route::get('/test-allstak', function() {
    AllStak::log('info', 'AllStak is working!', ['test' => true]);
    AllStak::flush();
    return 'Check your AllStak dashboard!';
});
```

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

[](#-documentation)

### Core Documentation

[](#core-documentation)

- **[Complete Usage Guide](USAGE_GUIDE.md)** - Comprehensive documentation (start here!)
- **[How to Use](HOW_TO_USE.md)** - Quick reference and summary
- **[API Documentation](README-API.md)** - API endpoint reference
- **[Code Examples](examples.php)** - Practical code examples

### Additional Resources

[](#additional-resources)

- **[Testing Guide](TESTING.md)** - Test the SDK in a Laravel app
- **[Changelog](CHANGELOG.md)** - Version history
- **[Migration Guide](MIGRATION.md)** - Upgrading from v1.x
- **[Logging Guide](LOGGING.md)** - Laravel logging integration

⚙️ Configuration
----------------

[](#️-configuration)

### Essential Settings

[](#essential-settings)

```
# Authentication
ALLSTAK_API_KEY=your-api-key
ALLSTAK_PROJECT_ID=your-project-id
# Features (all default to true)
ALLSTAK_CAPTURE_HTTP=true
ALLSTAK_CAPTURE_ERRORS=true
ALLSTAK_CAPTURE_LOGS=true
ALLSTAK_CAPTURE_DATABASE=true
# Performance
ALLSTAK_SAMPLE_RATE=1.0         # 0.0 to 1.0 (1.0 = 100%)
ALLSTAK_BATCH_SIZE=100
ALLSTAK_FLUSH_INTERVAL=5000     # milliseconds
# Privacy
ALLSTAK_ANONYMIZE_IP=false
ALLSTAK_SCRUB_HEADERS="Authorization,Cookie"
ALLSTAK_EXCLUDED_PATHS="/health,/metrics"
```

See **[config/AllStakConfig.php](config/AllStakConfig.php)** for all options.

🔍 What Gets Captured?
---------------------

[](#-what-gets-captured)

### HTTP Requests

[](#http-requests)

- Method, URL, headers, body
- Response status, headers, body
- Duration, client IP, user agent
- Session and user information

### Errors &amp; Exceptions

[](#errors--exceptions)

- Exception type and message
- Stack trace with file/line numbers
- Request context
- User and session data

### Database Queries

[](#database-queries)

- SQL statements (parameterized)
- Query bindings (separately)
- Execution time
- Success/failure status

### Application Logs

[](#application-logs)

- Log level (debug, info, warn, error)
- Message and context
- Timestamp and trace ID
- File and line number

### Custom Spans

[](#custom-spans)

- Operation name and duration
- Parent-child relationships
- Custom attributes
- Success/error status

🛠️ Requirements
---------------

[](#️-requirements)

- **PHP:** &gt;= 7.4
- **Laravel:** 5.0 - 12.0
- **Symfony HTTP Client:** &gt;= 4.4
- **Monolog:** &gt;= 1.25

🧪 Testing
---------

[](#-testing)

Run the standalone test suite:

```
php test_suite.php
```

Or see **[TESTING.md](TESTING.md)** for testing in a Laravel app.

🔐 Privacy &amp; Security
------------------------

[](#-privacy--security)

### IP Address Control

[](#ip-address-control)

```
ALLSTAK_ANONYMIZE_IP=true  # Mask last octet
ALLSTAK_SEND_CLIENT_IP=false  # Don't send at all
```

### Header Scrubbing

[](#header-scrubbing)

Sensitive headers are automatically redacted:

```
ALLSTAK_SCRUB_HEADERS="Authorization,Cookie,X-API-Key"
```

### SQL Safety

[](#sql-safety)

Query bindings are sent separately, never interpolated into SQL strings.

📊 API Reference
---------------

[](#-api-reference)

### Main Methods

[](#main-methods)

```
// Error tracking
AllStak::captureError(Throwable $e, ?Request $request, array $context): bool
// Logging
AllStak::log(string $level, string $message, array $attributes): bool
// Performance monitoring
AllStak::startSpan(string $name, ?string $parentSpanId): array
AllStak::endSpan(array $span, string $status, ?string $message): bool
// Database tracking
AllStak::captureQuery(string $sql, array $bindings, float $duration,
                     string $connection, bool $success, ?string $error): bool
// Batch management
AllStak::flush(): bool
// ID generation
AllStak::generateTraceId(): string  // 32-char hex (OpenTelemetry)
AllStak::generateSpanId(): string   // 16-char hex (OpenTelemetry)
```

🐛 Troubleshooting
-----------------

[](#-troubleshooting)

### No Events Appearing?

[](#no-events-appearing)

1. **Check configuration:**

```
php artisan tinker
>>> config('allstak.api_key')
>>> config('allstak.enabled')
```

2. **Test connectivity:**

```
curl -X POST http://localhost:8080/api/v2/ingest/batch \
  -H "x-api-key: your-key" \
  -H "Content-Type: application/json" \
  -d '{"logs":[],"errors":[],"requests":[],"queries":[],"spans":[]}'
```

3. **Force flush:**

```
AllStak::log('test', 'Test message');
AllStak::flush();
```

See **[USAGE\_GUIDE.md](USAGE_GUIDE.md#troubleshooting)** for more help.

📝 Version Information
---------------------

[](#-version-information)

**Current Version:** 2.0.0
**Release Date:** November 14, 2025
**API Version:** v2
**Authentication:** x-api-key header
**Endpoint:** /api/v2/ingest/batch

🤝 Support
---------

[](#-support)

- **Documentation:** [USAGE\_GUIDE.md](USAGE_GUIDE.md)
- **Examples:** [examples.php](examples.php)
- **Issues:** Report bugs and request features
- **Email:**

📄 License
---------

[](#-license)

MIT License - See [LICENSE.md](LICENSE.md) for details
------------------------------------------------------

[](#mit-license---see-licensemd-for-details)

**Made with ❤️ by the AllStak Team**

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance58

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

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

Total

8

Last Release

449d ago

PHP version history (3 changes)1.0.0PHP ^8.2

1.0.1PHP &gt;=8.0 &lt;9.0

1.0.4PHP &gt;=7.2 &lt;9.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/43ae6b43d197ff4a0be310d3f604ec14d0ed07f39ea381fa722490872bf58610?d=identicon)[AllStak](/maintainers/AllStak)

---

Top Contributors

[![abdualziz-techsea](https://avatars.githubusercontent.com/u/160937060?v=4)](https://github.com/abdualziz-techsea "abdualziz-techsea (108 commits)")

### Embed Badge

![Health badge](/badges/allstak-laravel-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/allstak-laravel-sdk/health.svg)](https://phpackages.com/packages/allstak-laravel-sdk)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[beyondcode/laravel-server-timing

Add Server-Timing header information from within your Laravel apps.

5712.0M1](/packages/beyondcode-laravel-server-timing)[rollbar/rollbar-laravel

Rollbar error monitoring integration for Laravel projects

14110.4M7](/packages/rollbar-rollbar-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[kitloong/laravel-app-logger

Laravel log for your application

101.2M8](/packages/kitloong-laravel-app-logger)[label84/laravel-auth-log

Log user authentication actions in Laravel.

3654.0k](/packages/label84-laravel-auth-log)

PHPackages © 2026

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