Download the PHP package suadhuskic/bench without Composer
On this page you can find all versions of the php package suadhuskic/bench. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download suadhuskic/bench
More information about suadhuskic/bench
Files in suadhuskic/bench
Package bench
Short Description Easy way to present user friendly time zones.
License MIT
Homepage https://github.com/suadhuskic/Bench
Informations about the package bench
[Bench]
Bench is a PHP library that helps you present user friendly time zones without having a database.
You shouldn't be scared of time zones and you shouldn't present America/Los_Angeles
as an option to the user.
Just to get your attention, heres an example:
The answer is YES. I do take Daylight/Standard into consideration. The abbreviations are generated after starting the Carbon instance using the $time
you passed.
The code above will output:
Installation
With Composer
Getting an array of countries:
Or get a specific country. don't forget timezones are lazy-loaded.
Now if you want the time zones for a country; call the getter:
getters for Bench\Country
:
getCode
- A two-letter ISO 3166-1 compatible country code.getName
- the full country name-
getTimezones(string $time='now', bool $unqiueOffsets=false)
- get all time zones.
We want to use Bench\Bench as the factory. Getting a
Bench\TimeZone
instance:getters for
Bench\TimeZone
: getName
- America/Los_AngelesgetShortAbbr
- PDTgetLongAbbr
- Pacific Daylight TimegetLongAbbrWithGMTOffset
- (GMT -07:00) Pacific Daylight Time-
getOffset(string $type='human')
- human=-07:00, hours=-7, *=-25200