Download the PHP package gautammkgarg/psr-for-wordpress without Composer

On this page you can find all versions of the php package gautammkgarg/psr-for-wordpress. 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 psr-for-wordpress

PSR for WordPress

License: GPL v3

A PSR implementation library for WordPress that bridges PSR interfaces to WordPress's native APIs. Currently implements:


Why This Package Exists

WordPress bundles its own HTTP transport (wp_remote_request). It handles proxies, SSL, redirects, and other platform-specific concerns automatically.

Libraries like omnipay/common, and others use php-http/discovery to auto-detect a PSR-18 HTTP client. Without this package, they'd pull in Guzzle — adding a heavy dependency and bypassing WordPress's HTTP layer.

This package gives you:


Requirements


Installation


Usage

Auto-discovery (Omnipay, php-http/discovery)

Add to your project's composer.json:

That's it. php-http/discovery will find Psr18Client automatically when any library calls Psr18ClientDiscovery::find().

Manual Usage

Custom Options

Global Timeout Override via WordPress Filter

Instead of manually configuring the client, use WordPress's native hook:


How It Works

Inside WordPress

When wp_remote_request() is available, the client calls it directly:

Outside WordPress

Install dependency using composer require rmccue/requests.

When wp_remote_request() is not available:


Exceptions

Exception Interface When Thrown
NetworkException Psr\Http\Client\NetworkExceptionInterface WP_Error or transport exception
RequestException Psr\Http\Client\RequestExceptionInterface Invalid request (e.g., empty URI)

Both exceptions implement getRequest() to retrieve the original PSR-7 request.

PSR-16 Simple Cache

Two adapters are provided, both implementing Psr\SimpleCache\CacheInterface:

Adapter WordPress Backend Persistence Best For
WpTransientsCache set_transient, get_transient Always persistent (DB by default, Redis if plugin) Tokens, API responses, settings that must survive requests
WpObjectCache wp_cache_set, wp_cache_get Only with Redis/Memcached plugin Query results, computed values reused within request

Usage

Companion Key Pattern — Storing false Correctly

WordPress returns false for both "key not found" and "value is false". We solve this by creating a companion key ({key}__found_psr16__) only when false is stored. Non-false values are stored raw — so native get_transient() can read them without mangling.

Feature This Package
False handling Companion key (only for false)
Native WordPress interop for non-false values ✅ Yes — values stored raw
Performance overhead Near-zero (companion keys created only for false values)

Guzzle vs This Package — Timeout Difference

Guzzle uses 0 as the default timeout, meaning no timeout at all. That's why Guzzle never fails for slow APIs. This package defaults to 10 seconds — which is more appropriate for production WordPress sites than WordPress's built-in 5-second default. Increase it as needed.


License

GPL-3.0-or-later. See LICENSE for full text.


All versions of psr-for-wordpress with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
nyholm/psr7 Version ^1.5
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/simple-cache Version ^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 gautammkgarg/psr-for-wordpress contains the following files

Loading the files please wait ...