Download the PHP package audunru/version-warning without Composer

On this page you can find all versions of the php package audunru/version-warning. 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 version-warning

Warn SPA users when client is outdated compared to server

Build Status Coverage Status StyleCI

Laravel middleware to help you notify users who are using an outdated version of the SPA client.

When you deploy a new version of your SPA to your server, not all users will start using the new version immediately. Anyone who is already logged in and does not refresh the page, will continue to use the old client until they close the browser tab or refresh the page. This package is meant to help you notify users with an outdated client that they should reload in order to use the latest version.

Currently, the package gets its version info from a package.json file in the root folder. This means that you will have to update the version in the package.json file whenever you make a change that requires all clients to update.

Installation

Step 1: Install with Composer

Step 2: Add middleware to your routes

Add the VersionWarning middleware to your API routes:

Step 3: Notify user when client is outdated

Alternative A: Compare X-App-Version header client side

When you make a fetch request to the server, add a X-App-Version header with a value of the client's current version. E.g.: X-App-Version: 1.18.1.

The VersionWarning middleware will compare the client version to the server version, and add a header called X-Version-Warning to the response if the versions do not match.

On the client side, you should check for the presence of the X-Version-Warning header. If it is present, the user should be notified that a reload is necessary so that the latest client assets (JavaScript and CSS) can be loaded.

Alternative B: Compare X-App-Version header client side

The VersionWarning middleware adds a header called X-App-Version to the response. On the client side, you can compare this version to the client version and notify the user in case of a mismatch.

Which version is the client running?

Set client version during build

If you're using Laravel Mix, you can include the current version during build time.

Set the MIX_VERSION environment variable in your build script (you should install the cross-var and cross-env packages so that this works on both Mac/Windows):

You can then use process.env.MIX_VERSION in your frontend code.

Get client version from HTML meta tag

Add the following to your layout blade template:

In your frontend code, read the value of this meta tag.

Configuration

Publish the configuration file by running:

Development

Testing

Run tests:


All versions of version-warning with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^12.0
spatie/laravel-package-tools Version ^1.9
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 audunru/version-warning contains the following files

Loading the files please wait ....