Download the PHP package cyberpunkcodes/laravel-moment-timezone without Composer

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

Laravel Moment Timezone

Laravel package to convert dates/times to the user's local time using Moment and Moment Timezone.

A special thanks to Blade UI Kit for the base of this package. If you need UI components like inputs, buttons, alerts, be sure to check them out.

Installation

Install using Composer:

Add the directive to your layout, right before the closing </body> tag, after all other scripts have been loaded, to load the required JavaScript files:

It is recommended to publish the config file so future updates to this package don't upgrade the Moment and Moment Timezone JavaScript files and surprise you in production. By publishing the config file, the asset versions won't update until you manually update them in the config.

Publish the config file by running:

In config/moment.php you will see an assets array with a child scripts array. Each of the scripts in this array will be directly printed when called by the @momentScripts directive.

Include the full <script></script> tag. This is so you can copy it from a source like CDNJS and keep the integrity hash checking.

Optionally, you can add the scripts to your asset bundling/minifying processors. In which case, you would not use the @momentScripts directive.

If you want to customize the component's view file, run:

Usage

Replace all the dates/times in your view files with the moment component

That will display as: January 23rd, 2023 at 12:07 pm

The default usage uses PHP's datetime formatting. For more details, read the PHP docs here: https://www.php.net/manual/en/datetime.format.php

Human Readable

To display as human readable, which prints "2 minutes ago" or "2 months ago", you can simply add the human attribute like so:

Local Timezone

Finally, if you want to show the dates/times in the user's local timezone, simply add the local attribute like so:

It is important to note that the format when using the local attribute must use the formatting rules from Moment and not PHP. See the Moment formatting rules for more info: https://momentjs.com/docs/#/displaying/format/

Here is a side-by-side comparison of both. They both result in displaying the exact same.

PHP Format: F jS, Y \a\t g:i a

Moment Format: MMMM Do, Y [at] h:mm a

Both will display as: January 23rd, 2023 at 12:07 pm

Prefix

If you have another component named moment and are experiencing a conflict, you can define a custom prefix.

If you set your prefix to cool then you would use the component like so:

After you rename a component, you may see errors about the component not being able to be found. This is due to view caching. You must clear the view cache:

Contributing

I intend on keeping this package simple. The use case is only for Moment and Moment Timezone. If you find an error/bug, or want to help clean up this readme, please create an issue first so we can discuss it before you waste time on a pull request.


All versions of laravel-moment-timezone with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version ^9.0|^10.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 cyberpunkcodes/laravel-moment-timezone contains the following files

Loading the files please wait ....