Originally posted by Jonjolt
View Post
Announcement
Collapse
No announcement yet.
PHP 8.4 Released With Property Hooks, Lazy Objects & Other New Features
Collapse
X
-
Originally posted by caligula View Post
Ok that's nice. Previously 'killall java' killed all Java apps? I've noticed that IDEA doesn't use that executable name anymore but I thought they had customized their JDK somehow.
Sources here for jpackage https://github.com/openjdk/jdk/tree/...c/jdk.jpackage
Comment
-
Originally posted by uid313 View PostYes, exactly, I would have an RESTful endpoint so I know how to deserialize based on the name of the endpoint which is in the URI, so for example I would have the HTTP endpoint /api/pets/ which accepts GET and POST requests, and I would have /api/pets/{id} which accepts GET, PUT and DELETE requests so when a client does a POST request against the pet endpoint I know that I should attempt to deserialize the request body into a Pet object which would be an instance of the Pet class. If the deserialization would fail I would return the HTTP status code 400 Bad Request.
Comment
-
Originally posted by murraytony View Post
Sounds like you want Laravel Route Model Binding + Laravel Form Requests (maybe even API Resources). Pretty simple stuff, and as always there a packages to make it even simpler.
Comment
-
Originally posted by uid313 View PostA very good update with lots of new great improvements. Personally I think the new asymmetric visibility thing is confusing.
I think that the syntax for property hooks is a bit verbose since you have to repeat the data type and the variable name, this is much cleaner in C#.
I would like to see PHP support for expression-bodied functions like they have in C# so that you can write a function on one line with => arrow and skip the return keyword.
I think PHP have some problems:- JSON support is very poor, you can only serialize to stdClass or an associated array, not to your own classes so you don't have type safety, and you cant override property names if you want to serialize a kebab-case JSON into a camelCase property.
- There is no support for UUID (I know there are third-party libraries available, but I think it should be in the standard library).
- HTTP support is very poor, you have to use the very awkward libcurl, I would like to see a modern HTTP request support in the standard library, like the Fetch API in JavaScript, the HttpClient class in .NET, or the requests/httpx library in Python.
As for UUIDs, as someone who wrote one such third-party library, it would be nice, but I haven't had it come up much.
I'm baffled about your complaints over JSON, though. You'd need a lot of plumbing to map JSON to arbitrary classes, wouldn't you? Does anything do that?
Comment
-
Originally posted by J.King View PostI agree with you about needing a more ergonomic HTTP client. Guzzle and the like are fine and all, but it's exactly the sort of niche the standard library ought to fill—especially since we're already most of the way there with stream wrappers. It just needs to have a proper API.
As for UUIDs, as someone who wrote one such third-party library, it would be nice, but I haven't had it come up much.
I'm baffled about your complaints over JSON, though. You'd need a lot of plumbing to map JSON to arbitrary classes, wouldn't you? Does anything do that?
I am sure Java have powerful JSON too. The serde-json library in Rust was alright too. In my experience JSON have been the poorest in PHP and Python.
Comment
Comment