Ray Skill
Overview
Ray is Spatie's desktop debugging application for developers. Send data directly to Ray by making HTTP requests to its local server. This is what the
PHP function does under the hood.
Connection Details
| Setting | Default | Environment Variable |
|---|
| Host | | |
| Port | | |
| URL | | - |
Request Format
Method: POST
Content-Type:
User-Agent:
Basic Request Structure
json
{
"uuid": "unique-identifier-for-this-ray-instance",
"payloads": [
{
"type": "log",
"content": { },
"origin": {
"file": "/path/to/file.php",
"line_number": 42,
"hostname": "my-machine"
}
}
],
"meta": {
"ray_package_version": "1.0.0"
}
}
Fields
| Field | Type | Description |
|---|
| string | Unique identifier for this Ray instance. Reuse the same UUID to update an existing entry. |
| array | Array of payload objects to send |
| object | Optional metadata (ray_package_version, project_name, php_version) |
Origin Object
Every payload includes origin information:
json
{
"file": "/Users/dev/project/app/Controller.php",
"line_number": 42,
"hostname": "dev-machine"
}
Payload Types
Log (Send Values)
json
{
"type": "log",
"content": {
"values": ["Hello World", 42, {"key": "value"}]
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
Custom (HTML/Text Content)
json
{
"type": "custom",
"content": {
"content": "<h1>HTML Content</h1><p>With formatting</p>",
"label": "My Label"
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
Table
json
{
"type": "table",
"content": {
"values": {"name": "John", "email": "john@example.com", "age": 30},
"label": "User Data"
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
Color
Set the color of the preceding log entry:
json
{
"type": "color",
"content": {
"color": "green"
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
Available colors: ,
,
,
,
,
Screen Color
Set the background color of the screen:
json
{
"type": "screen_color",
"content": {
"color": "green"
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
Label
Add a label to the entry:
json
{
"type": "label",
"content": {
"label": "Important"
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
Size
Set the size of the entry:
json
{
"type": "size",
"content": {
"size": "lg"
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
Notify (Desktop Notification)
json
{
"type": "notify",
"content": {
"value": "Task completed!"
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
New Screen
json
{
"type": "new_screen",
"content": {
"name": "Debug Session"
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
Measure (Timing)
json
{
"type": "measure",
"content": {
"name": "my-timer",
"is_new_timer": true,
"total_time": 0,
"time_since_last_call": 0,
"max_memory_usage_during_total_time": 0,
"max_memory_usage_since_last_call": 0
},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
For subsequent measurements, set
and provide actual timing values.
Simple Payloads (No Content)
These payloads only need a
and empty
:
json
{
"type": "separator",
"content": {},
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
| Type | Purpose |
|---|
| Add visual divider |
| Clear all entries |
| Hide this entry |
| Remove this entry |
| Show confetti animation |
| Bring Ray to foreground |
| Hide Ray window |
Combining Multiple Payloads
Send multiple payloads in one request. Use the same
to apply modifiers (color, label, size) to a log entry:
json
{
"uuid": "abc-123",
"payloads": [
{
"type": "log",
"content": { "values": ["Important message"] },
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
},
{
"type": "color",
"content": { "color": "red" },
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
},
{
"type": "label",
"content": { "label": "ERROR" },
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
},
{
"type": "size",
"content": { "size": "lg" },
"origin": { "file": "test.php", "line_number": 1, "hostname": "localhost" }
}
],
"meta": {}
}
Example: Complete Request
Send a green, labeled log message:
bash
curl -X POST http://localhost:23517/ \
-H "Content-Type: application/json" \
-H "User-Agent: Ray 1.0" \
-d '{
"uuid": "my-unique-id-123",
"payloads": [
{
"type": "log",
"content": {
"values": ["User logged in", {"user_id": 42, "name": "John"}]
},
"origin": {
"file": "/app/AuthController.php",
"line_number": 55,
"hostname": "dev-server"
}
},
{
"type": "color",
"content": { "color": "green" },
"origin": { "file": "/app/AuthController.php", "line_number": 55, "hostname": "dev-server" }
},
{
"type": "label",
"content": { "label": "Auth" },
"origin": { "file": "/app/AuthController.php", "line_number": 55, "hostname": "dev-server" }
}
],
"meta": {
"project_name": "my-app"
}
}'
Availability Check
Before sending data, you can check if Ray is running:
GET http://localhost:23517/_availability_check
Ray responds with HTTP 404 when available (the endpoint doesn't exist, but the server is running).
Payload Type Reference
| Type | Content Fields | Purpose |
|---|
| (array) | Send values to Ray |
| , | HTML or text content |
| , | Display as table |
| | Set entry color |
| | Set screen background |
| | Add label to entry |
| | Set entry size (sm/lg) |
| | Desktop notification |
| | Create new screen |
| , , timing fields | Performance timing |
| (empty) | Visual divider |
| (empty) | Clear all entries |
| (empty) | Hide entry |
| (empty) | Remove entry |
| (empty) | Confetti animation |
| (empty) | Show Ray window |
| (empty) | Hide Ray window |