Download the PHP package blackbricksoftware/wp-artifact-updater without Composer

On this page you can find all versions of the php package blackbricksoftware/wp-artifact-updater. 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 wp-artifact-updater

wp-artifact-updater

WordPress updates for plugins that don't live on wordpress.org.

Point it at the release artifact your build already publishes — a zip in Bitbucket Downloads or a GitHub release asset — and WordPress treats the plugin like any other: update notice, one-click update, and the per-plugin "Enable auto-updates" toggle all start working.

Plus one header in the plugin's main file:


Why this exists

WordPress can only update what it can find on wordpress.org. The usual answer is plugin-update-checker, and it's a good library — but its Bitbucket integration installs the tag archive (bitbucket.org/…/get/<ref>.zip), which is the repository tree. A composer-based plugin's tree has no vendor/, so the "update" installs a plugin with no autoloader that fatals on activation. There is no Downloads support to point it at instead, and its auth header is gated on a /get/ URL prefix, so rewriting the download URL yields a 401.

This library installs what your pipeline built, which is the thing you actually tested.

What it deliberately does not do

Install

Requires PHP 8.0+ and WordPress 4.6+ (5.8+ uses the better Update URI path automatically). No dependencies.

Configuration

Key Required Meaning
plugin_file yes Your plugin's main file, normally __FILE__. Basename, slug and installed version are read from it — don't repeat them.
source yes A Source: BitbucketDownloads or GitHubReleases.
artifact yes PCRE selecting the release file. Capture group 1 is the version, when the filename has one.
authorization no callable(): string returning an Authorization header value. '' means none.
enabled no callable(): bool. Defaults to "the source needs no credential, or one is configured".
ttl no Cache lifetime for the release lookup. Default 6 hours.

authorization is a header value, not a username and password

Different hosts and token types want different schemes, and the caller knows which it has:

enabled — the off switch

By default, a private source with no credential registers no hooks and makes no HTTP requests. That is what keeps the library out of the way on composer-managed installs, where the deploy owns the plugin version and a self-update would be reverted on the next deploy.

A public source has nothing to switch it off, so pass enabled yourself:

Bitbucket

Reads the repository's Downloads list and picks the highest version matching artifact — by version comparison, not list order, so 2.10.0 correctly beats 2.9.0.

Credentials. There is no Downloads-only scope; repository (read) is the finest grant Bitbucket offers. Prefer a repository access token, which is scoped to a single repository and isn't tied to a person's account (an app password dies when that user is deactivated — a memorable way to discover your update mechanism depended on someone's employment). A leaked per-repo token reads one repository whose code the site already has on disk.

GitHub

Reads the latest release and picks the matching asset. If artifact captures a version, that wins; otherwise the version comes from tag_name, so a workflow publishing a fixed filename works:

What your pipeline must produce

Three requirements, each of which fails silently if you get it wrong:

  1. A built artifact, not a source archive. Run composer install --no-dev --optimize-autoloader and include vendor/. A tag archive installs a plugin with no autoloader.
  2. A single top-level directory named exactly like the plugin folder. Stage into dist/my-plugin/ and zip that. zip -r my-plugin.zip . produces an archive with no wrapping folder, and WordPress then names the destination after the zip file — installing a second copy under a different folder name instead of upgrading. It looks like it worked.
  3. A plugin header version that matches the release. WordPress reads the installed version from the header. If the header says 1.0.0 while you publish 1.0.2, every site installs 1.0.2, still reports 1.0.0, and is offered the update again — forever. Bump the header in the commit you tag. (This is a real bug we shipped, not a hypothetical.)

A Bitbucket pipeline doing all three:

Checking a credential

A bad credential fails silently — no release is found, which looks exactly like being up to date. So verify it rather than waiting to find out:

One cheap request, never throws, and status === 0 means the host could not be reached rather than the credential being wrong. Worth calling when a credential is saved, and from a "test this token" button — tokens get revoked long after anyone remembers configuring them.

Bitbucket token form: paste a repository access token on its own; it is sent as Bearer <token>. The x-token-auth:<token> form is for git over HTTPS and the REST API rejects it with a 401 (verified against a live repository).

Forcing a re-check

Two caches sit between a published release and the Plugins screen: ours (6 hours) and WordPress's own update transient (it re-asks at most twice a day). Clearing either one alone achieves nothing — ours gets refilled from a check WordPress won't run yet, and WordPress's gets refilled from our stale answer. forceRecheck() clears both:

It drops our cached release, removes this plugin's entries from the update transient, and resets last_checked so core's twice-a-day gate reopens. It deliberately does not delete the whole update_plugins transient: that would throw away what the site knows about every other plugin's updates, and keeping our own entries around would let an "update available" outlive the credential that found it.

Call it from a "check for updates now" control, and whenever the credential changes — a no release found cached against the old credential otherwise makes a good new one look broken too.

How it behaves

Namespacing

The namespace carries a major version — BlackBrickSoftware\WpArtifactUpdater\V1 — and the layout mirrors it:

PSR-4 maps BlackBrickSoftware\WpArtifactUpdater\ to src/, so a breaking change is a new src/V2/ directory and nothing else: no autoload change, and V1 keeps working for plugins that haven't moved.

Two plugins on one site can each ship their own copy of V1 in vendor/ and the first one loaded wins — harmless, because it's the same code. Only an actual breaking change needs a new major, and then the two coexist.

If a plugin ever vendors third-party dependencies into its zip, prefix them at build time with PHP-Scoper — that's the general fix for WordPress's one-global-namespace problem, and it's a separate concern from this library.

Testing an update without shipping one

Tag a throwaway patch release and watch it appear:

Both lines are needed: the first clears our cache, and the second only does anything once WordPress's own twelve-hour gate has passed — which is why a plugin exposing forceRecheck() behind a button is worth the ten lines.

Licence

MIT.


All versions of wp-artifact-updater with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 blackbricksoftware/wp-artifact-updater contains the following files

Loading the files please wait ...