Download the PHP package kabiroman/ttlsemlock-client without Composer

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

TtlSemLock PHP Client

๐Ÿ”’ High-performance PHP client for TtlSemLock distributed semaphore

PHP Version

Features

Requirements

๐Ÿ“‹ See COMPATIBILITY.md for detailed version support and migration guide

Compatibility Matrix

Component Version PHP 8.1 PHP 8.2 PHP 8.3+ Status
TtlSemLock Core 0.2.x โœ… โœ… โœ… Fully tested
Symfony Lock 6.4 LTS โœ… โœ… โœ… Production ready
Symfony Lock 7.0 Current โœ… โœ… โœ… Production ready
Symfony Lock 7.3 Latest โŒ โœ… โœ… Requires PHP 8.2+

Framework Support

Framework Version Compatibility Notes
Symfony 6.4 LTS โœ… Full Via TtlSemLockStore adapter
Symfony 7.0+ โœ… Full Native PersistingStoreInterface
Laravel 9.x+ ๐Ÿ”„ Planned Custom Lock driver planned
Native PHP Any โœ… Full Direct TtlSemLock client

Installation

Via Composer (Recommended)

For Symfony Integration

Manual Installation

  1. Download the source code
  2. Include the autoloader:

Quick Start

Basic Usage

Using with API Key (v0.4.0+)

For production environments with API key authentication enabled:

Advanced Usage

Symfony Integration

TtlSemLock can be used as a backend for Symfony Lock Component:

Symfony Framework Configuration

For Symfony 6.4 LTS (PHP 8.1+)

For Symfony 7.0+ (PHP 8.2+)

Environment Variables

Service Configuration with API Key (v0.4.0+)

Security Configuration (v0.4.0+)

TtlSemLock supports API Key authentication for secure production deployments:

Server Configuration

Create config.security.json:

Start server with security:

PHP Client with Authentication

Error Handling

Best Practices

API Reference

Constructor

Core Methods

acquire(string $key, int $ttl, string $pid = '', string $host = ''): bool

Acquire a distributed lock.

release(string $key): bool

Release a distributed lock.

exists(string $key): bool

Check if a lock exists and is active.

extend(string $key, int $ttl, string $owner): bool

Extend TTL of an existing lock.

stats(): array

Get server statistics.

Convenience Methods

acquireWithOwner(string $key, int $ttl): ?string

Acquire lock with automatic owner generation.

acquireWithRetry(string $key, int $ttl, int $maxRetries = 3, int $retryDelay = 100000): ?string

Try to acquire lock with retry logic.

withLock(string $key, int $ttl, callable $callback, ...$args): mixed

Execute a callback with distributed lock.

Examples

Basic Lock Operations

TTL Extension

Retry Logic

Callback Pattern

Migration Guide

From Redis/Memcached to TtlSemLock

Replace your existing Symfony Lock store configuration:

Version Compatibility Testing

Test compatibility with your PHP/Symfony versions:

Performance Comparison

Store Type Latency Throughput Memory
TtlSemLock ~0.2ms 5K+ ops/sec Low
Redis ~0.5ms 3K ops/sec Medium
Memcached ~0.3ms 4K ops/sec Medium
Database ~2ms 500 ops/sec High

Error Handling

The client throws specific exceptions for different error types:

Performance

The PHP client is optimized for high performance:

Run the performance test:

Requirements

Configuration

Connection Settings

Server Configuration

Ensure your TtlSemLock server is configured correctly:

Testing

Run the examples to test functionality:

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Write tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support


TtlSemLock PHP Client - Part of the TtlSemLock distributed semaphore system.


All versions of ttlsemlock-client with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
symfony/lock Version ^6.4|^7.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 kabiroman/ttlsemlock-client contains the following files

Loading the files please wait ....