Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

deevo's avatar
Level 5

API License License Table Future Expiration Date vs nullable()

Community,

Question: I have a table of Licenses and Products. Every product will have a license and some products will need to be have their license renewed annually to continue receiving updates to the products. The products themselves have an API to call back to check for a valid license. If license is valid, updates are delivered, if not, no update will ever run.

Not all products will need to be renewed to continue to receive updates.

So, the real question is, if I have a Table of license keys that have an "expires_on" timestamp field, do you think it would be better to make that field be nullable() or set the expires_on date into far into the future for those products that do not need to be renewed?

0 likes
3 replies
ohffs's avatar
ohffs
Best Answer
Level 50

I have a similar thing and allowed it to be nullable - then just had a helper on the model of something like hasExpired() which did the conditional check. At the time anyway I felt it was clearer that null meant never :-)

1 like
deevo's avatar
Level 5

I think I will go with the null. I think you are right that it makes more sense that null on the expires_on field says that it never will expire.

I am going to append a boolean attribute onto the model for something like "is_active" so I can just check the API call pretty easily if a product is active and in need of an update.

Thank you for the reply!

Please or to participate in this conversation.