Download the PHP package srawnay/laravel-timezone without Composer

On this page you can find all versions of the php package srawnay/laravel-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 laravel-timezone

Laravel Timezone

Latest Version on Packagist Total Downloads Licence Quality Score StyleCI Buy us a tree Treeware (Trees)

An easy way to set a timezone for a user in your application and then show date/times to them in their local timezone.

How does it work

This package listens for the \Illuminate\Auth\Events\Login event and will then automatically set a timezone on your user model (stored in the database).

This package uses the torann/geoip package which looks up the users location based on their IP address. The package also returns information like the users currency and users timezone. You can configure this package separately if you require.

How to use

You can show dates to your user in their timezone by using

Or use our nice blade directive

More examples below

Installation

Pull in the package using Composer

Publish database migrations

Run the database migrations. This will add a timezone column to your users table.

Examples

Showing date/time to the user in their timezone

Default will use the format jS F Y g:i:a and will not show the timezone

If you wish you can set a custom format and also include a nice version of the timezone

Using blade directive

Making your life easier one small step at a time

And with custom formatting

Saving the users input to the database in UTC

This will take a date/time, set it to the users timezone then return it as UTC in a Carbon instance.

Custom Configuration

Publishing the config file is optional.

Flash Messages

When the timezone has been set, we display a flash message, By default, is configured to use Laravel default flash messaging, here are some of the optional integrations.

laracasts/flash - 'flash' => 'laracasts'

mercuryseries/flashy - 'flash' => 'mercuryseries'

spatie/laravel-flash - 'flash' => 'spatie'

mckenziearts/laravel-notify - 'flash' => 'mckenziearts'

usernotnull/tall-toasts - 'flash' => 'tall-toasts'

To override this configuration, you just need to change the flash property inside the configuration file config/timezone.php for the desired package. You can disable flash messages by setting 'flash' => 'off'.

Overwrite existing timezones in the database

By default, the timezone will be overwritten at each login with the current user timezone. This behavior can be restricted to only update the timezone if it is blank by setting the 'overwrite' => false, config option.

Default Format

By default, the date format will be jS F Y g:i:a. To override this configuration, you just need to change the format property inside the configuration file config/timezone.php for the desired format.

Lookup Array

This lookup array configuration makes it possible to find the remote address of the user in any attribute inside the Laravel request helper, by any key. Having in mind when the key is found inside the attribute, that key will be used. By default, we use the server attribute with the key REMOTE_ADDR. To override this configuration, you just need to change the lookup property inside the configuration file config/timezone.php for the desired lookup.

Underlying GeoIp Package

If you wish to customise the underlying torann/geoip package you can publish the config file by using the command below.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

This package is 100% free and open-source, under the MIT license. Use it however you want.

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

Issues

If you receive a message like This cache store does not support tagging this is because the torann/geoip package requires a caching driver which supports tagging and you probably have your application set to use the file cache driver. You can Read more about this issue here.


All versions of laravel-timezone with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
laravel/framework Version 5.6.* || 5.7.* || 5.8.* || ^6 || ^7 || ^8 || ^9
torann/geoip Version ^3.0
nesbot/carbon Version ^1.0 || ^2.0
treeware/plant Version dev-main
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 srawnay/laravel-timezone contains the following files

Loading the files please wait ....