Closed thill-odi closed 4 years ago
Probably worth noting that this is 1d as defined in the MoSCoW.
Mostly prototyping making a basic model system on the PHP end, and that seems to work fairly well. Ended up making more than one model (one main, 2 very small 1-2 field ones), as a core part of this is actually testing the serialization/deserialization of nested models.
At some point I'd make more progress by actually having the set of models (so that I can test on larger JSON strutures), so may need to pause this soon until we have a start to the model generation, and should be able to refine the structure of this in parallel.
While developing this, I have found Guzzle's Webservice Client which looks absolutely amazing (thanks for mentioning it @tholder), maybe one to look into in the future - seems to be trying to do some of the same things, but isn't a perfect match.
Great stuff @ylt ! Can I check you've seen my comment in https://github.com/openactive/models-php/issues/1#issuecomment-535472698 - do you think it'll work as low as 5.4?
Yeah have seen that comment, 5.4 is very EOL (September 2015!) and I would be surprised if any modern library supports it.
https://www.php.net/supported-versions.php https://www.php.net/eol.php
The code we have so far is mostly compatible apart from the class name constants which can be easily swapped out. The main problems is that the newer versions of PHP add lots more in terms of type checking, and if we're going to be validating then those are features that we ideally use.
If the models themselves (which I'm assuming would be separate library, and key dependency for everything else?) work back to 5.4 without convoluting the code, then that's the main thing - let's chat about validation logic when we get to it (it's in the reference implementation and library, which is outside of scope for now, as we may have an alternative plan for that)
How far back do you reckon we can go with the class name constants swapped out? Interested to know what the lowest version we support is?
Note: in our sector there are lots of old systems kicking about, especially PHP ones, so having this work as far backwards as is reasonable without us creating a mess is definitely more inclusive
It will have it's downsides, we'll lose type hinting for modern editors / IDE's, etc and this will also convulute the code a little bit.
Does look like we /could/ take it down to 5.3 maybe. Just will take a bit more time.
Maybe this is one to discuss with @coatezy when he's back in next week.
ok sure, am not aware of the detailed constraints. If we can keep it as low as possible while keeping type hinting that seems ideal.
Will do a full survey to see how many are impacted. Let me know the lowest version that would keep type hinting (but not necessarily validation)?
Noting offline conversation: PHP 5.6 will include type hinting
This is a great page: https://www.php.net/manual/en/appendices.php
So, to get from 5.4: https://www.php.net/manual/en/migration55.incompatible.php 5.4 -> 5.5 incompatible changes https://www.php.net/manual/en/migration56.incompatible.php 5.5 -> 5.6 incompatible changes
I imagine it could be the "Windows XP and 2003 support dropped" that could be the main issue?
Thanks that's helpful!
This has been completed
0.5d