Download the PHP package kevinorriss/clienttimezone without Composer

On this page you can find all versions of the php package kevinorriss/clienttimezone. 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 clienttimezone

clienttimezone

Gets the clients timezone difference from UTC in minutes using Javascript.

How it works

If the client timezone is not stored in the session, the javascript will fire a POST ajax request, sending the clients current time offset in minutes from the UTC time. This offset is then stored in session and the users browser reloads the current page. Javascript will then only have to do this once, or until a new session is started.

Installation

  1. Add ClientTimezone to your composer.json file under require:

    "kevinorriss\clienttimezone": "1.2.*"

  2. Add the ClientTimezoneServiceProvider to your app.php file:

    KevinOrriss\ClientTimezone\ClientTimezoneServiceProvider::class,

  3. Add the ClientTimezone alias to your app.php file:

    'ClientTimezone' => KevinOrriss\ClientTimezone\ClientTimezone::class,

  4. Run composer update

Usage

In order to use this package, you need to setup your application so that Ajax calls send the CSRF token.

  1. Add the following meta tag to your main blade layout file

    <meta name="csrf-token" content="{{ csrf_token() }}" />

  2. Add the javascript ajax setup code using jquery, you could create public/js/main.js and add this script to you main layout

  3. In your main layout add the following line AFTER your jQuery script tag

    @include('clienttimezone::javascript')

Example

Carbon

ClientTimezone is best used with Carbon to display the users current time.

Skipping

There may be times when you do not want javascript to check the client timezone. An example of this is when the client creates a new session on your application by following a URL to verify their email address, this page displays a flash message, but will be shown briefly until Javascript reloads the page. Upon the page reload, the flash message will have expired.

To prevent Javascript from checking the client timezone and reloading the page if it needs to, just add this line to your controller before returning a view.

ClientTimezone::skip();

Overrides

You can override any of the ClientTimezone constant values by simply adding a value of the same name inside the .env file, for example:

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details


All versions of clienttimezone with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
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 kevinorriss/clienttimezone contains the following files

Loading the files please wait ....