Download the PHP package alex-no/server-time-clock without Composer

On this page you can find all versions of the php package alex-no/server-time-clock. 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 server-time-clock

Server Time Clock

Latest Stable Version Total Downloads License PHPUnit

PSR-20 clock implementation that returns the current server time based on its local timezone or online providers.

Installation

Install via Composer:

Usage

Configuration Options

Key Type Description
client string Preferred time provider (WorldTimeApi, IpGeoLocation, etc.)
credentials array API keys for time providers (optional)
enable_cache bool Enable APCu-based caching (default: false)
cache_ttl int Cache duration in seconds
useMock bool Enable/Disable Mock for tests (default: false)

Providers

🌐 WorldTimeApi – no key required

🌐 IpGeoLocation – requires free API key from ipgeolocation.io

🌐 TimeApiIo – no key required

Laravel Integration

You can integrate this package into Laravel with minimal setup.

Configuration (Optional)

To publish the config file:

This will create config/server-clock.php:

Usage in Laravel

Yii2 Integration

Configuration

You may use the ServerClock class directly or configure it as a Yii2 component:

Usage

Then use it:

Note: Yii2 support is optional and requires yiisoft/yii2 to be installed in your project.

Optional Dependencies

This package is framework-agnostic. Laravel and Yii2 integrations are provided for convenience.

Framework Package Required?
Laravel laravel/framework Optional
Yii2 yiisoft/yii2 Optional

APCu Cache Requirements

If you enable caching (enable_cache => true), make sure the APCu extension is installed and enabled in your PHP configuration. This typically means:

You can verify if APCu is available by running:

Testing

Run PHPUnit tests:

License

MIT License

Made with ❤️ by Oleksandr Nosov


All versions of server-time-clock with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
psr/clock Version ^1.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 alex-no/server-time-clock contains the following files

Loading the files please wait ...