Skip to content

[13.x] Add InteractsWithData plainString method to retrieve data as a string#60861

Closed
devhammed wants to merge 2 commits into
laravel:13.xfrom
devhammed:feat/add-plain-string-method-to-request
Closed

[13.x] Add InteractsWithData plainString method to retrieve data as a string#60861
devhammed wants to merge 2 commits into
laravel:13.xfrom
devhammed:feat/add-plain-string-method-to-request

Conversation

@devhammed

Copy link
Copy Markdown
Contributor

I believe the string method in InteractsWithData should be returning actual PHP strings instead of a Stringable instance, while we keep str for that purpose because there are genuine cases where I want a nullable string, but Stringable would have already converted it to an empty string so we end up having to check for empty string or go back to using the input method. Still, since it has been used that way and changing the behaviour is a breaking change, it is only fair for us to have a way to retrieve typed data, just as there is for other types like integer, boolean, enums, arrays, etc.

@taylorotwell

Copy link
Copy Markdown
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

@devhammed
devhammed deleted the feat/add-plain-string-method-to-request branch July 22, 2026 14:35
@devhammed

Copy link
Copy Markdown
Contributor Author

@taylorotwell Would you be open to making this changing the return value of the ->string() method to string|null in Laravel 14.x as mentioned here: https://x.com/sander_scode/status/2079972655424282979?

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