Skip to content

[13.x] Add isBlank() and isNotBlank() to Stringable - #62415

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
stevebauman:stringable-blank-checks
Nov 11, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
stevebauman:stringable-blank-checks

Conversation

@stevebauman

Copy link
Copy Markdown
Contributor

This PR adds isBlank() and isNotBlank() to Stringable, allowing you to check whether a string is blank directly within a fluent string chain.

For example, checking whether an HTML editor submitted an empty paragraph becomes:

// Before...
blank(str($bio)->stripTags());

// After...
str($bio)->stripTags()->isBlank();

Both methods follow the existing blank() helper's behavior:

str('   ')->isBlank();      // true
str('Hello')->isNotBlank(); // true
str('0')->isBlank();        // false

@taylorotwell
taylorotwell merged commit 86c0362 into laravel:13.x Nov 11, 2026
64 checks passed
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.

2 participants