Prescribed way to set cookies (from plugin or Twig) From either a plugin or a Twig template, is there a prescribed way to set (and get) cookies?

I've seen https://github.com/lewisjenkins/craft-lj-cookies/, which just uses PHP's setcookie.

Also noticed getCookie in craft.request. https://craftcms.com/docs/templating/craft.request#getCookie

I've noticed the cookies set with setcookie aren't readable by getCookie. How should one set a cookie so that it is readable by getCookie?
Cookies cannot be set via templates. However, in a plugin you have access to Craft's services. The UserSessionService has the saveCookie function.

craft()-&gt;userSession-&gt;saveCookie($cookieName, $data, $duration);