jamesmills / laravel-timezone

Enable user Timezones in your application.
MIT License
677 stars 91 forks source link

Create breaking API for version 2 #93

Open grantholle opened 1 year ago

grantholle commented 1 year ago

Here is the beginning of the API change for v2.

I will wait to make any readme/documentation updates until all the details have been worked out. Something that I've added in there that isn't in my package is utilizing Carbon\FactoryImmutable (see references in this section) to generate dates that also includes a locale. I also added a trait that can be included on the user that retrieves its factory,now() and today().

$user->now();
// Same as doing
TImezone::now();
// or
local_now();

Instead of supporting all the different libraries for flashing a message, I just added an event that is dispatched. The dev can just listen for that event and do whatever they want at that time.

The main function names are the same as before. I've ported my own tests and added an action to run tests. I think some more could be cleaned up around code style, but this is a big start.