Best practices for URL-friendly multi-word tags

What are the pros and cons between using urlendecode + urlencode or str:slug?

Beside the former using + to join words with a space and the latter preferring -, is it just a matter of taste when using them to output text for URLs? Is one more performant than the other?

Hm, the use case for both is completely different, I think. I use str::slug() to create folder names from titles (e.g. when creating new pages programmatically), not the url encode and decode strings. There is no str::unslug()method to "undo" thestr::slug()` method.

So for multi word tags, you should use urlencode() and urldecode().

So the preferred method would be

if(!empty(param('author'))) {
   $tag_author = urldecode(param('author'));
   $results = $results->filterBy('author', ($tag_author), ',');
}

instead of

if(!empty(param('author'))) {
    $filter = str::slug(param('author'));
    $results = $results->filter(function($result) use($author) {
      $author = array_map('str::slug', $result->author()->split(','));
      if(in_array($filter, $author)) return true;
    });
  }

?

Thank you for the answer. As I personally prefer to have spaces replaced by - rather than +, would there be a different way to achieve the same result but not using str:slug?

I guess you can use str::slug(), but then you need to unslug again, which could probably be achieved by using str_replace()