Download the PHP package zaengle/timezone without Composer

On this page you can find all versions of the php package zaengle/timezone. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package timezone

Timezone Select Form Builder

This package is a fork from Camron Cade modified to fit Zaengle's usage. For more information, read Camron's helpful article on managing timezones in Laravel. The array of timezones and their underlying keys were taken from the repository by tamaspap.

Installation

Recommended installation of this package is through composer. Run the following snippet to add Timezone to your project:

composer require zaengle/timezone

Note: You may jump to Usage if you are on Laravel 5.5+

Once this operation completes, the final step is to add the service provider. Open config/app.php, and add a new item to the service providers array.

'Zaengle\Timezone\TimezoneServiceProvider'

In order to use the Facade, update the aliases array as such:

`Timezone` => `Zaengle\Timezone\Facades\Timezone`,

Now it's ready for use!

Usage

Timezone Convert Helper Functions

The package includes two helper functions that make it easy to deal with displaying and storing timezones, convertFromUTC() and convertToUTC():

Each function accepts two required parameters and a third optional parameter dealing with the format of the returned timestamp.

Timezone::convertFromUTC($timestamp, $timezone, $format);
Timezone::convertToUTC($timestamp, $timezone, $format);

The first parameter accepts a timestamp, the second accepts the name of the timezone that you are converting to/from. The option values associated with the timezones included in the select form builder can be plugged into here as is. Alternatively, you can use any of PHP's supported timezones.

The third parameter is optional, and default is set to 'Y-m-d H:i:s', which is how Laravel natively stores datetimes into the database (the created_at and updated_at columns).

Building a select form

Using the Timezone::toSelectArray() you can build an array of enabled timezones similar to this:

[
    "America/Los_Angeles" => "(UTC-08:00) Pacific Time (US & Canada)",
    "US/Mountain" => "(UTC-07:00) Mountain Time (US & Canada)",
    "US/Central" => "(UTC-06:00) Central Time (US & Canada)",
    "US/Eastern" => "(UTC-05:00) Eastern Time (US & Canada)",
]

Then, in your Blade template you have control over formatting:

<select name="timezone" id="timezone">
    @foreach(Timezone::toSelectArray() as $key=>$val)
        <option value="{{ $val }}" @if($union->timezone === $val) selected @endif>{!! $key !!}</option>
    @endforeach
</select>

Customizing timezones

If you want to customize which timezones are displayed in the toSelectArray() method, publish the package configuration file and enable/disable individual timezones:

php artisan vendor:publish --tag=config --provider="Zaengle\Timezone\TimezoneServiceProvider"

Credits

Camron Cade


All versions of timezone with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
illuminate/support Version >=4.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package zaengle/timezone contains the following files

Loading the files please wait ....