Function mysqli-escape-string from PHP doesn't help you with doing any sanitization against XSS. It was intended to attempt to escape strings, that could cause SQL Injection. It is now deprecated and shouldn't be used anymore. The preferred way in PHP to prevent your code against SQL Injection is to use Prepared Statement with bind variables.
That said, neither Slick nor Scala have built-in functions doing string sanitization against XSS.
Slick has a nice feature, that changes all strings you are inserting using interpolation to bind variables, which prevents SQL Injection, but it has nothing to do with preventing XSS (it is something similar to Prepared Statements but with less boilerplate).
To prevent XSS you should use some library, which allows sanitization of strings, that might potentially contain XSS. There's Java project java-html-sanitizer from OWASP, that does that. You could use it like:
object HtmlSanitizer {
//First define your policy for allowed elements
private lazy val policy = new HtmlPolicyBuilder()
.allowElements("p")
.allowElements("a")
.allowUrlProtocols("https")
.allowAttributes("href").onElements("a")
.requireRelNofollowOnLinks()
.toFactory()
def sanitize(unsafeHTML: String) = policy.sanitize(unsafeHTML)
}
and then:
HtmlSanitizer.sanitize("<p><svg/onload=alert('XSS')</p>") // "<p></p>"