The singular helper method in Laravel is used to convert a plural word into its singular form. This method is the opposite of the plural method. It follows similar internal mechanisms as the plural method. In Laravel, you can also use the str_singular() function as a shortcut to calling Str::singular.
The slug helper method in Laravel is used to format a given title into a URI slug. It converts the title to ASCII, replaces whitespace and separators with a specified character, and trims whitespace and separators from the beginning and end of the string. The str_slug function serves as a shortcut to the Str::slug method, making it easier to use in global namespace.
The snake helper method in Laravel's Str class converts a string to snake case by replacing uppercase letters with the lowercased variant, optionally separated by a delimiter. The method also trims whitespace from the string being converted. Laravel provides a global snake_case function as a shortcut to calling Str::snake.
startsWith is a helper method in Laravel that checks if a given string starts with any of the specified values. It is the opposite of the ends_with method and follows the same rules of use. The starts_with function provides a shortcut to calling Str::startsWith and is defined in the global namespace. You can use this method to easily check if a string begins with a specific substring.
The plural helper method in Laravel is used to return the plural version of a given value. It applies general rules to strings and handles special cases. The str_plural function is a shortcut to calling Str::plural.
Learn how to use the replaceFirst() helper method in PHP to replace the first occurrence of a string with another string in a given subject string. This method requires three parameters - the search string, the replacement string, and the subject string. Explore examples and a shortcut function called str_replace_first() that can be used to call Str::replaceFirst in your code.
Learn how to use the replaceLast helper method in PHP to replace the last occurrence of a string with another string. The method requires three parameters: $search, $replace, and $subject, all of which must be strings. Additionally, there is a shortcut to calling the replaceLast method using the global str_replace_last function.
Learn how to use the substr helper method in Laravel, which provides a convenient way to return a portion of a string. Unlike PHP's mb_substr function, substr always uses the UTF-8 encoding. You can specify the start position and length of the substring. Check out examples of how to use this helper method with different parameters.
This method converts the given value into a traditional print title by capitalizing the first character of each word. It may affect the case of every character in the string. You can use the title helper method or the title_case helper function as shortcuts.
Learn how to use the ucfirst helper method in Laravel to capitalize the first letter of a string. This method is useful for handling multi-byte strings, unlike PHP's ucfirst function. See code examples for implementation and combining with the finish helper method.
The past six months or so have been incredibly busy. What started as a new article series about cust...
Read moreIn this post I talk about how I resolved a mysterious illegal offset type error when viewing collect...
Read moreGenerating a custom Laravel routes file from a Statamic website to redirect to a new domain.
Read moreDisabling file hashes in Vite output can be accomplished by modifying your project's vite.config.js
Read moreLearn how to implement a custom component compiler for Laravel's Blade templating language in this p...
Read morePart 5 of 6 covers implementing a cache namespace and labeling system, which we can use to target mu...
Read more