danielstjules / Stringy

A PHP string manipulation library with multibyte support
MIT License
2.46k stars 216 forks source link

Suddenly namespace stopped working #148

Closed entheologist closed 7 years ago

entheologist commented 7 years ago

When I first started using stringy, I added this line at the top of my bootloader: use Stringy\Stringy as S;

and I was able to use it throughout the site like this: $this->entityName = s($entity_slug)->upperCamelize();

but suddenly it stopped working for some reason. Now I'm getting this error message: Fatal error: Call to undefined function s() in C:\wamp64\www\spider\chebi\orm_tools.php on line 39

any idea what the problem here might be?

danielstjules commented 7 years ago

@entheologist I think the issue is that you're importing the class Stringy\Stringy as S (uppercase), but actually meant to import the function Stringy\create as s (lowercase)

https://github.com/danielstjules/Stringy#php-56-creation

use function Stringy\create as s;

Hope that helps!