yii class to handle custom string manipulation?

sorry to be asking so many stupid questions in one day (but the documentation doesn’t seem to cover simple things too good)

what class in yii is responsible for string formatting?

is there even such a class?

for example i want to do the very common

str_to_lower, but i want to do it while supporting UTF8, so i need to add this custom function to some class in yii, which one? or do i create a separate application component? or how do you handle this simple thing with custom functions anyway?

You should use the mbstring functions in PHP. You can even override the standard string functions in PHP with their corresponding mbstring function. See here:

http://www.yiiframework.com/doc/cookbook/16/

ok

mbstring.func_overload = 7

mbstring.internal_encoding = UTF-8

solves that UTF-8 problem,

but what about normal extra functions, where (in what class) in yii do i put custom site-wide functions?

There’s no real “best practice” as Yii gives you much freedom. You could create a class with static methods in /components that Yii would autoinclude when you calll e.g. MyHelpers::doSomething(). Or you could use the approach used by Qiang in this cookbook article:

http://www.yiiframework.com/doc/cookbook/31/

thats what i wanted to hear, im already using the Qiang method for shortening some of the yii code. :)

thank you for taking time to answer this.