Skip to content

Enhance Slug Generation for camelCase and PascalCase Strings in Str::slug #56719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 12.x
Choose a base branch
from

Conversation

MoamenEltouny
Copy link

This pull request enhances the Str::slug method to better handle camelCase, StudlyCase, and PascalCase strings, ensuring that such cases are converted to properly formatted slugs. Additionally, new tests have been added to verify this improved functionality.

Slug generation improvements:

  • Updated the Str::slug method to detect camelCase, StudlyCase, and PascalCase strings and convert them to snake_case before generating the slug. This includes handling abbreviations by converting them to lowercase for consistent slug formatting.

Testing enhancements:

  • Added new test cases in SupportStrTest.php to verify slug generation for camelCase, StudlyCase, PascalCase, and strings containing abbreviations, ensuring the changes work as expected.

Enhance slug method to handle camel, studly, and pascal case and convert abbreviations to lowercase for no conflict with those cases.
Add test cases for camel, pascal/studly cases and covering the abbreviations case
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant