spatie/our-ray
Send Ray (myray.app) debug payloads to the cloud using ourray.app. Install via Composer and use the our() helper to forward any ray() calls: our()->ray('my debug data'); Great for sharing logs and debugging output across environments and teams.
composer require spatie/our-ray
php artisan vendor:publish --provider="Spatie\OurRay\OurRayServiceProvider"
our() helper to send Ray payloads:
our()->ray('Initial debug payload');
.env has OURRAY_APP_KEY set (or use the default RAY_APP_KEY fallback).config/our-ray.php (if published) for API key and endpoint settings.our() in your Blade templates, controllers, or services.Debugging in Controllers/Commands
public function processOrder(Request $request)
{
try {
$order = Order::create($request->all());
our()->ray('Order created', ['order_id' => $order->id]);
} catch (\Exception $e) {
our()->ray('Order creation failed', ['error' => $e->getMessage()]);
throw $e;
}
}
our()->ray() for critical paths (e.g., payments, API calls).Middleware for Global Debugging
public function handle($request, Closure $next)
{
our()->ray('Request started', [
'path' => $request->path(),
'method' => $request->method(),
]);
return $next($request);
}
Blade Templates
@if(config('app.debug'))
@php
our()->ray('User viewed profile', ['user_id' => auth()->id()]);
@endphp
@endif
config('app.debug') to avoid clutter in production.Queue Jobs
public function handle()
{
our()->ray('Job dispatched', ['job' => $this->job]);
// Job logic...
}
Log::debug() for structured logs:
our()->ray('User login', ['ip' => $request->ip()]);
Log::debug('Login attempt', ['user_agent' => $request->userAgent()]);
App\Exceptions\Handler to log exceptions:
public function report(Throwable $exception)
{
our()->ray('Unhandled exception', [
'exception' => $exception->getMessage(),
'trace' => $exception->getTraceAsString(),
]);
}
our()->ray('API Response', [
'status' => $response->status(),
'data' => $response->getData(),
]);
API Key Leaks
OURRAY_APP_KEY in config or environment files..env and restrict file permissions:
chmod 600 .env
ourray.app dashboard.Payload Size Limits
our()->ray()->chunk() for big data:
our()->ray()->chunk($largeArray, 100); // Split into chunks of 100 items
except():
our()->ray($data)->except(['password', 'api_token']);
Rate Limiting
public function handle($request, Closure $next)
{
if (our()->ray()->isRateLimited()) {
our()->ray('Rate limit exceeded');
}
return $next($request);
}
Environment-Specific Keys
OURRAY_APP_KEY=dev_key_123 # .env
OURRAY_APP_KEY=prod_key_456 # .env.production
our()->ray()->validate() to check structure:
our()->ray(['key' => 'value'])->validate();
ourray.app:
curl -v https://ourray.app/api/payloads
tail -f storage/logs/laravel.log | grep "OurRay"
Custom Payload Formatter
public function boot()
{
our()->extend(function ($payload) {
return [
'custom_key' => 'value',
'original' => $payload,
];
});
}
Webhook Integration
our()->onPayload(function ($payload) {
Http::post('https://your-webhook.com', $payload);
});
Conditional Logging
if (!app()->environment('local')) {
our()->disable();
}
Batch Processing
our()->ray()->batch() for grouped payloads:
our()->ray()->batch([
'user_action_1',
'user_action_2',
]);
How can I help you explore Laravel packages today?