I'm using controllers to serve JSON to a Vue.js frontend, and can't seem to find anything in the API documentation for using modifiers in a controller.

What's the syntax for using the smartypants modifier on a string?

I currently have this in a controller:

return [
  'title' => $entry->get('title'),
];

...but I need to get something like this, where 'title' has been run through smartypants:

'title' => smartypants($entry->get('title')),

I assume I need to use the BaseModifiers class:

use Statamic\View\BaseModifiers;

...but trying this throws an error:

'title' => BaseModifiers::smartypants($entry->get('title')),

Thanks in advance for any help someone can provide!

Answered by Jason Varga! Go to answer.