JavaScript

You can make data available to use in your JavaScript from your PHP by using the Enso facade.

use Enso;

// ...

$data = ['foo' => 'bar'];

Enso::setJSData('my_thing', $data);

Whatever you pass as a second parameter will be available as a parameter on the global enso object. E.g.:

console.log(enso.my_thing);