Customizing the output in Ray

#Expanding arrays and objects

When sending an array or object to Ray, it will be displayed in a collapsed state.

To open up a node, you can use the expand method.

// will open up the first level of nodes
ray($arrayOrObject)->expand();

// will open up the first three levels of nodes
ray($arrayOrObject)->expand(3);

// will open the node with key named `myKey`
ray($arrayOrObject)->expand('myKey');

// open up all nodes with the given names
ray($arrayOrObject)->expand('myKey', 'anotherKey');

// you can use dot notation to expand deeper nodes
ray($arrayOrObject)->expand('myKey.nestedKey');

You can also use the expandAll() method to expand all levels.

#Using colors

You can colorize things you sent to Ray by using one of the color functions.

ray('this is green')->green();
ray('this is orange')->orange();
ray('this is red')->red();
ray('this is blue')->blue();
ray('this is purple')->purple();
ray('this is gray')->gray();

screenshot

#Using sizes

Ray can display things in different sizes.

ray('small')->small();
ray('regular');
ray('large')->large();

screenshot

#Adding a label

You can customize the label displayed next to item with the label function.

ray(['John', 'Paul', 'George', 'Ringo'])->label('Beatles');

screenshot

#Displaying a table

You can send an associative array to Ray with the table function.

ray()->table([
    'First' => 'First value',
    'Second' => 'Second value',
    'Third' => 'Third value',
]);

screenshot

As a second argument, you can pass a label that will be displayed next to the table.

ray()->table(['John', 'Paul', 'George', 'Ringo'], 'Beatles');

screenshot

Help us improve this page