Package proposal: Business

31 views
Skip to first unread message

Florian Voutzinos

unread,
Dec 13, 2016, 6:29:23 AM12/13/16
to thephpleague
Hello,

I would like to propose my Business library to The PHP League.

It provides methods to work with dates depending on the business opening hours and holidays. You can use it to figure out the closest pickup time of a package, booking intervals, the number of business days until next year, etc.

As far as I know, there is no other similar libraries in PHP. 

Regards,

Florian

Sági-Kazár Márk

unread,
Dec 13, 2016, 6:32:36 AM12/13/16
to Florian Voutzinos, thephpleague
Hi there,

I would love to see this package in the League. I contributed this package a few times and I found it extremely useful.

Bests,
Mark

--
You received this message because you are subscribed to the Google Groups "thephpleague" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thephpleague+unsubscribe@googlegroups.com.
To post to this group, send email to thephp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/thephpleague/8976b5e5-b940-4171-8b5d-7e561b0aa9e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nyamsprod the funky webmaster

unread,
Dec 13, 2016, 6:39:07 AM12/13/16
to Florian Voutzinos, thephpleague
Hi Florian,

What is the difference or the added valude between your package and the spatie opening hours. To be honest I did not look your package but by the description I found them to be similar.

Regards,

Ignace

--
Message has been deleted

Florian Voutzinos

unread,
Dec 13, 2016, 7:36:06 AM12/13/16
to thephpleague, flo...@voutzinos.com

Hey,


I didn't know about this package, it was created recently, in September. Business was created two years ago.


I'm looking at their implementation and it seems you can only specify static opening hours. Business supports dynamic opening hours via closures. It's useful if you are open only one Monday every week and things like that. It provides more flexibility.


Also it can only tell you if it's open at a given date. Business gives you the next opening date. The internal algorithm is optimized so it translates to the next business date instead of a naive iteration.


Le mardi 13 décembre 2016 12:39:07 UTC+1, ignace nyamagana butera a écrit :
Hi Florian,

What is the difference or the added valude between your package and the spatie opening hours. To be honest I did not look your package but by the description I found them to be similar.

Regards,

Ignace
On Tue, Dec 13, 2016 at 12:29 PM, Florian Voutzinos <flo...@voutzinos.com> wrote:
Hello,

I would like to propose my Business library to The PHP League.

It provides methods to work with dates depending on the business opening hours and holidays. You can use it to figure out the closest pickup time of a package, booking intervals, the number of business days until next year, etc.

As far as I know, there is no other similar libraries in PHP. 

Regards,

Florian

--
You received this message because you are subscribed to the Google Groups "thephpleague" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thephpleague...@googlegroups.com.

Florian Voutzinos

unread,
Dec 13, 2016, 7:46:17 AM12/13/16
to thephpleague, flo...@voutzinos.com
I wanted to say "It's useful if you are open only one Monday every two weeks".

In Business you also have a timeline() method allowing you to build your own "business timeline" from a given date, to a given date using the specified period.

In opening hours, this is limited. You have to use forDay() or forDate() but it's not possible to specify the period between the returned dates which is hardcoded to 1 day.

nyamsprod the funky webmaster

unread,
Dec 13, 2016, 11:37:03 AM12/13/16
to Florian Voutzinos, thephpleague
Thanks for the clarification.

Of note, your package seems to be PHP5.4+ while the other package is PHP7+ . It would be great to update the requirement of your package and at least support DateTimeInterface. I don't know about you but since  DateTimeImmutable was introduced in PHP5.5 I stopped using DateTime.



To unsubscribe from this group and stop receiving emails from it, send an email to thephpleague+unsubscribe@googlegroups.com.

To post to this group, send email to thephp...@googlegroups.com.

Florian Voutzinos

unread,
Dec 13, 2016, 11:44:13 AM12/13/16
to thephpleague, flo...@voutzinos.com
Yes, I totally agree, it will need some cleanup. We also have a DateRange fitting our needs but I think we can just use https://github.com/thephpleague/period instead.

The main idea was to keep it very simple, we have only three main methods (algorithms) and you can derive anything from that.

Florian Voutzinos

unread,
Dec 13, 2016, 2:38:28 PM12/13/16
to thephpleague, flo...@voutzinos.com
If this is accepted, I think it needs to be done following these steps:

- open a repo
- use the League namespace
- refactor to use PHP 7+
- use League\Period instead of the current date range implementation
- eventually move some code to League\Period if it suits there
- remove the BusinessInterface as well so we can add more methods to Business without breaking BC
Reply all
Reply to author
Forward
0 new messages