Carray And Cstring


Are they any plans to add generic aux classes like CString and CArray that will contain misc useful methods?

This kind of classes is something I stumble upon in many places/projects that I work with.

For example, in CString we could have the following convenient methods:

  • [font="'Courier New"]bool static isStartingWith($str, $target);[/font]
  • [font="'Courier New"]bool static isEndingWith($str, $target);[/font]

In CArray, something that I just needed:

  • [font="'Courier New"]array static trimToSize($array, $size)[/font] - returns part of a multidimensional array, according to given $size.

Obviously, there could be more useful convenience methods that are good to have at your disposal and that I think that are good to have in a framework.

I can contribute the code for the ones mentioned above.

I agree these are useful methods, but I don’t think they belong in the framework as they are not specific to Yii.

No - don’t do it. :)

They removed most - if not all - such utility functions from CakePHP in 1.3 (IIRC) as it’s not specific to the framework.

And because it could conflict with whatever utility functions you might be using.

There must exist a ton of utility libraries for PHP ?

If you guys are using such libs, what’s your favorite?