Download the PHP package xxx-bin/php-tls-client without Composer

On this page you can find all versions of the php package xxx-bin/php-tls-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 php-tls-client

PHP TLS Client

A PHP wrapper for the tls-client library using PHP's FFI (Foreign Function Interface) extension.

Description

This library allows you to make HTTP requests with customizable TLS fingerprints from PHP, using the power of the tls-client library through FFI. It helps bypass TLS fingerprinting techniques used by some websites to detect and block non-browser traffic.

The library provides a convenient way to simulate various browser fingerprints, allowing you to make requests that appear to come from popular browsers like Chrome, Firefox, and Safari. This makes it particularly useful for web scraping and automated testing scenarios where you need to avoid detection.

This project is based on Sahil1337/node-tls-client, ported from Node.js to PHP. The primary improvement in this PHP version is the optimization of payload construction through dedicated builder classes.

Features

tls-client Features

PHP Wrapper Features

Requirements

Installation

Via Composer (Recommended)

Manual Installation

  1. Make sure you have PHP 7.4+ with FFI extension enabled
  2. Clone or download this repository
  3. Run composer install to install dependencies

The required tls-client shared library will be automatically downloaded on first use.

Usage

Advanced Usage

Custom TLS Configuration

For more advanced use cases, you can create custom TLS configurations using the builder pattern:

FFI Direct Usage

For advanced users who want to directly use FFI to call the tls-client library, check out the https://bogdanfinn.gitbook.io/open-source-oasis/shared-library/payload

Automatic Library Download

This library automatically downloads the required tls-client shared library for your platform on first use:

The library is downloaded from the official tls-client releases page and saved to your system's temporary directory.

You can monitor the download progress as it happens.

Examples

Check out the examples directory for more detailed usage examples:

  1. Simple request - Basic GET request
  2. With headers - Request with custom headers
  3. POST request - Sending data with POST
  4. Using proxy - Making requests through a proxy
  5. Custom JA3 - Using a custom TLS fingerprint
  6. Custom JA3 with builder - Using a custom TLS fingerprint with the builder pattern
  7. Multiple requests - Multiple requests in one session
  8. With cookies - Working with cookies
  9. FFI Simple - Direct FFI usage example

Session Options

The Session constructor accepts an array of options:

Option Type Description
sessionId string A unique identifier for the session
headers array Default headers to send with requests
proxyUrl string Proxy URL in format http://user:pass@ip:port
tlsClientIdentifier string Browser identifier (use ClientIdentifier constants)
customTlsClient array Custom TLS client configuration
timeoutMilliseconds int Request timeout in milliseconds
timeoutSeconds int Request timeout in seconds
followRedirects bool Follow HTTP redirects
forceHttp1 bool Force HTTP/1.1 protocol
withDebug bool Enable debug mode
insecureSkipVerify bool Skip SSL certificate verification
headerOrder array Define the order of HTTP headers
isByteRequest bool Indicates if the request is a byte request
isByteResponse bool Indicates if the response is a byte response
isRotatingProxy bool Indicates if using a rotating proxy
requestBody string Request body content
requestCookies array Request cookies
requestHostOverride string Override the request host
withRandomTLSExtensionOrder bool Randomize TLS extension order
withoutCookieJar bool Disable cookie jar functionality
withDefaultCookieJar bool Use default cookie jar
catchPanics bool Catch panics during request
certificatePinningHosts array Hosts for certificate pinning
transportOptions array Transport layer options
defaultHeaders array Default headers
connectHeaders array Connection headers
disableIPV6 bool Disable IPv6
disableIPV4 bool Disable IPv4
disableHttp3 bool Disable HTTP/3
localAddress string Local address to bind to
serverNameOverwrite string Overwrite server name
streamOutputBlockSize int Stream output block size
streamOutputEOFSymbol string Stream output EOF symbol
streamOutputPath string Stream output path
h2Settings array HTTP/2 settings configuration

Request Options

Each request method (get, post, put, etc.) accepts an options array:

Option Type Description
headers array Request headers
body string Request body
followRedirects bool Follow redirects
proxyUrl string Proxy URL for this request
cookies array Cookies to send with the request

Commonly used options:

Option Type Description
tlsClientIdentifier string Browser identifier for this request
customTlsClient array Custom TLS client configuration for this request
timeoutMilliseconds int Request timeout in milliseconds
timeoutSeconds int Request timeout in seconds
forceHttp1 bool Force HTTP/1.1 protocol
withDebug bool Enable debug mode
insecureSkipVerify bool Skip SSL certificate verification
headerOrder array Define the order of HTTP headers
isByteRequest bool Indicates if the request is a byte request
isByteResponse bool Indicates if the response is a byte response
isRotatingProxy bool Indicates if using a rotating proxy
requestHostOverride string Override the request host
withRandomTLSExtensionOrder bool Randomize TLS extension order
withoutCookieJar bool Disable cookie jar functionality
withDefaultCookieJar bool Use default cookie jar
catchPanics bool Catch panics during request
certificatePinningHosts array Hosts for certificate pinning
transportOptions array Transport layer options
defaultHeaders array Default headers
connectHeaders array Connection headers
disableIPV6 bool Disable IPv6
disableIPV4 bool Disable IPv4
disableHttp3 bool Disable HTTP/3
localAddress string Local address to bind to
serverNameOverwrite string Overwrite server name
streamOutputBlockSize int Stream output block size
streamOutputEOFSymbol string Stream output EOF symbol
streamOutputPath string Stream output path
h2Settings array HTTP/2 settings configuration

Response Methods

The response object has the following methods:

Method Description
text() Get response body as text
json() Get response body as JSON (parsed array)
status() Get HTTP status code
headers() Get response headers
cookies() Get response cookies
url() Get the final URL after redirects
ok() Check if status is 200-299
usedProtocol() Get the protocol used (HTTP/1.1, HTTP/2, etc.)
sessionId() Get the session ID
id() Get the response ID

Client Identifiers

Available client identifiers (use the constants in ClientIdentifier class):

Chrome

Brave

Safari

Firefox

Opera

Mobile Clients

Other

Error Handling

The library throws exceptions for various error conditions:

Always wrap your code in try-catch blocks for proper error handling.

License

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

Acknowledgments

This library is based on bogdanfinn's tls client in Go and the PHP wrapper implementation.


All versions of php-tls-client with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
ext-ffi Version *
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 xxx-bin/php-tls-client contains the following files

Loading the files please wait ...