Download the PHP package fundraisingbox/symfony-precognition without Composer

On this page you can find all versions of the php package fundraisingbox/symfony-precognition. 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 symfony-precognition

Symfony Precognition FundraisingBox

CI Latest release

A Symfony bundle that validates a request without executing the controller body. A precognitive request runs the normal argument-resolution validation or an explicitly annotated Symfony Form, then short-circuits before the controller runs. This lets a client validate input — for example during live form validation — without creating or mutating anything.

Routes are opt-in by default. Add #[Precognitive] to a controller method or class that uses #[MapRequestPayload], #[MapQueryString], #[MapUploadedFile], or a custom value resolver. Symfony Forms opt in with #[PrecognitiveForm].

[!IMPORTANT] Precognition only runs validation performed during argument resolution, plus explicitly annotated Symfony Forms. Validation and business rules inside the controller do not run. A 204 means that the input is structurally valid, not that the operation would succeed.

Installation

Symfony Flex enables the bundle automatically. Without Flex, add it to config/bundles.php:

Quick start

Add #[Precognitive] to a route whose arguments are validated:

Send the same request that would be submitted normally, with the Precognition header:

A valid request receives:

An invalid #[MapRequestPayload] request receives the application's normal validation response, usually 422, with Precognition: true and Vary: Precognition headers.

Clients should always check the Precognition: true response header. If a route has not opted in, the request behaves as if the bundle were absent and the controller runs normally.

Configuration

Routes must opt in by default. To let every route answer precognitively, enable global mode:

Install symfony/form as well when using #[PrecognitiveForm]:

Documentation

Prior art

This bundle ports the request/response protocol of Laravel Precognition, also described for Rails by Inertia Precognition. The request and success protocol matches, but validation errors retain Symfony's native status codes and response body.

[!WARNING] The official Laravel Precognition frontend SDKs are not drop-in compatible because they expect Laravel's validation error shape. See the compatibility guide for details and a bridge recipe.

Maintainers & Contribution

Maintained by FundraisingBox Developers. This not an official product by FundraisingBox.

Contributions are welcome - please do not flood with vibe-coded PRs though.

License

MIT. See LICENSE.


All versions of symfony-precognition with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
symfony/config Version ^6.4 || ^7.0 || ^8.0
symfony/dependency-injection Version ^6.4 || ^7.0 || ^8.0
symfony/event-dispatcher Version ^6.4 || ^7.0 || ^8.0
symfony/http-foundation Version ^6.4 || ^7.0 || ^8.0
symfony/http-kernel Version ^6.4 || ^7.0 || ^8.0
symfony/validator Version ^6.4 || ^7.0 || ^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 fundraisingbox/symfony-precognition contains the following files

Loading the files please wait ...