Download the PHP package expertsystemsau/laravel-conditional-requests without Composer

On this page you can find all versions of the php package expertsystemsau/laravel-conditional-requests. 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 laravel-conditional-requests

Laravel Conditional Requests

HTTP conditional requests for Laravel — ETag, Last-Modified, 304 Not Modified, and lost-update protection with If-Match.

Packagist PHP from Packagist Laravel versions GitHub Workflow Status (main) Total Downloads

Conditional requests are the part of HTTP that lets a client and a server agree on which version of a resource they are talking about, before either of them acts on it. RFC 9110 §13 defines them; ETag and Last-Modified are just the two validators underneath.

They solve two different problems with the same handshake:

Most Laravel packages in this space only do the first half, and only via ETag. This one treats conditional requests as the feature and validators as an implementation detail.

Requirements

Installation

Install the package via Composer:

The service provider is auto-discovered. No further setup is required to get started.

Quickstart

A conditional read. Apply the middleware to a route that returns a cacheable representation. The response gets a validator, and a matching subsequent request is answered 304 Not Modified with an empty body.

A guarded write. Add required to a route that changes something, and the client has to say which version it believes it is modifying. Add the contract and the trait to the model so the middleware can ask the record its version:

That is the whole surface. docs/writes.md cover everything else.

Before you put this in front of users

Six things can bite you. Each is one click away, and the full register has twelve more with a scan table.

Header reference

Request header Applies to On match On mismatch Ships
If-None-Match reads 304 Not Modified 200 OK with body yes
If-None-Match: * writes 412 Precondition Failed write proceeds yes
If-None-Match (concrete tag, weak comparison) writes, without required 412 Precondition Failed write proceeds yes
If-None-Match (concrete tag) writes, when required 428 Precondition Required 428 Precondition Required yes
If-Modified-Since reads 304 Not Modified 200 OK with body yes
If-Match writes write proceeds 412 Precondition Failed yes
If-Unmodified-Since writes write proceeds 412 Precondition Failed yes
(absent) writes, when required — 428 Precondition Required yes

Documentation

Coming from werk365/etagconditionals?

The migration guide maps setEtag, ifNoneMatch, ifMatch and the etag group onto conditional and its flags, lists the behaviour changes you will hit on day one, and says plainly when not to bother.

Stability

v1.0.0 and later follow Semantic Versioning. docs/api.md names exactly what that covers — every contract, the trait, the middleware alias and its flags, the config keys, the exceptions. Anything not on that list is internal and may change in any release.

The list is not a promise in prose: tests/Feature/PublicApiTest.php reflects the actual surface and fails when it differs from the frozen one.

Testing

composer test:lock is not part of composer test, so the suite stays runnable with nothing but PHP and SQLite. It proves that a competing session's row lock forces a 503, which SQLite cannot demonstrate at all — lockForUpdate() compiles to nothing there. Point it at a database you can throw away:

Without those variables every test in it skips, naming them. CI runs it against MySQL and PostgreSQL on every push and fails if it skipped.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Thank you for considering contributing to Laravel Conditional Requests! Please review our contributing guide to get started.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

Prior art: werk365/etagconditionals mapped out this territory for Laravel first, and is worth a look if you need something available today.

License

Laravel Conditional Requests is open-sourced software licensed under the MIT license.


All versions of laravel-conditional-requests with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/contracts Version ^12.0||^13.0
illuminate/database Version ^12.0||^13.0
illuminate/http Version ^12.0||^13.0
illuminate/routing Version ^12.0||^13.0
illuminate/support Version ^12.0||^13.0
symfony/http-foundation Version ^7.2||^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 expertsystemsau/laravel-conditional-requests contains the following files

Loading the files please wait ...