composer require allstak/sdk-php
.env):
ALLSTAK_API_KEY=ask_live_your_key_here
ALLSTAK_ENVIRONMENT=local # or 'production'
ALLSTAK_RELEASE=myapp@1.0.0
// config/app.php
'providers' => [
AllStak\Laravel\AllStakServiceProvider::class,
],
use AllStak\Facade;
Facade::captureError(new RuntimeException('Test error'));
Facade::captureLog('info', 'Test log', ['key' => 'value']);
config/allstak.php or via environment variables (e.g., ALLSTAK_CAPTURE_EXCEPTIONS=false).Facade::captureError(Exception $e)Facade::captureLog(string $level, string $message, array $context)Facade::captureMessage(string $message, array $context)// config/allstak.php
'collectors' => [
'http' => [
'enabled' => true,
'capture_body' => true, // Capture request/response bodies (default: false)
],
],
$client = new \GuzzleHttp\Client([
'handler' => \AllStak\Laravel\Guzzle\AllStakHandler::create(),
]);
Facade::captureHttpRequest('GET', 'https://api.example.com', [
'headers' => ['Authorization' => 'Bearer token'],
'body' => ['key' => 'value'],
]);
'collectors' => [
'pdo' => ['enabled' => true],
'eloquent' => ['enabled' => true],
],
Facade::captureQuery('SELECT * FROM users', ['bindings' => [1]], 123);
app/Exceptions/Handler.php:
public function report(Throwable $exception)
{
if (!app()->bound('telescope')) {
Facade::captureError($exception);
}
parent::report($exception);
}
Facade::captureLog('error', 'Failed to process order', ['order_id' => 123]);
// Or integrate with Monolog:
$logger->pushHandler(new \AllStak\Laravel\Monolog\AllStakHandler());
schedule:run command. Manually trigger:
Facade::captureCronJob('daily-backup', 'Backup completed', ['status' => 'success']);
Facade::captureMetric('orders.processed', 42, ['status' => 'success']);
$trace = Facade::startTrace('user_checkout');
try {
// Business logic
} finally {
$trace->end();
}
$trace = Facade::startTrace('process_payment');
PaymentJob::dispatch($order);
$trace->end();
config(['allstak.collectors.exceptions.enabled' => false]);
config/allstak.php for environment-specific toggles:
'collectors' => env('APP_ENV') === 'local' ? [
'http' => ['enabled' => false],
] : [],
Performance Overhead:
capture_body: true) can slow down high-traffic endpoints.'collectors' => [
'http' => [
'enabled' => true,
'capture_body' => env('APP_ENV') !== 'production',
],
],
Sensitive Data Leakage:
Facade::captureLog('info', 'Login attempt', [
'user_id' => 123,
'ip' => request()->ip(),
'password' => '[REDACTED]', // Always redact!
]);
ALLSTAK_IGNORE_KEYS env var to auto-redact keys:
ALLSTAK_IGNORE_KEYS=password,token,api_key
Double Instrumentation:
Guzzle Handler Conflicts:
AllStakHandler may not be applied to all.$client = new \GuzzleHttp\Client([
'handler' => \AllStak\Laravel\Guzzle\AllStakHandler::create(),
]);
Cron Job Auto-Detection:
Facade::captureCronJob('custom-command', 'Command executed', ['status' => 'success']);
Check Captured Data:
ALLSTAK_DEBUG=true
allstak log channel in Laravel:
Log::channel('allstak')->debug('Test debug message');
Network Issues:
curl -X POST https://api.allstak.com/v1/events \
-H "Authorization: Bearer $ALLSTAK_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Configuration Overrides:
config/allstak.php:
// config/allstak.php
'api_key' => env('ALLSTAK_API_KEY', 'fallback_key'),
Custom Collectors:
use AllStak\CollectorInterface;
class CustomCollector implements CollectorInterface {
public function capture(array $data) {
// Send data to AllStak
Facade::send($data);
}
}
$this->app->bind(CollectorInterface::class, function () {
return new CustomCollector();
});
Middleware for HTTP Capture:
namespace App\Http\Middleware;
use AllStak\Facade;
use Closure;
class AllStakEnrichment {
public function handle($request, Closure $next) {
$response = $next($request);
Facade::captureHttpMetadata('
How can I help you explore Laravel packages today?