Download the PHP package nixphp/form without Composer

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

![Logo](https://nixphp.github.io/docs/assets/nixphp-logo-small-square.png) [![NixPHP Form Plugin](https://github.com/nixphp/form/actions/workflows/php.yml/badge.svg)](https://github.com/nixphp/form/actions/workflows/php.yml)

โ† Back to NixPHP


nixphp/form

Form handling the NixPHP way โ€” minimal, secure, intuitive, extendable.

This plugin provides form memory, CSRF protection, a flexible Validator system, and a full set of view helpers for easy form handling in your NixPHP applications.

Everything is registered automatically and works without configuration.


๐Ÿ“ฆ Features


๐Ÿ“ฅ Installation

The plugin registers itself. No additional setup needed.


๐Ÿš€ Usage

๐Ÿง  Form Memory

memory($key, $default = null)

Restores previous user input:

memory_checked($key, $value = 'on')

Works for checkboxes:

memory_selected($key, $expected)

Works for selects:

Memory is powered by param() and persists automatically after POST requests.


๐Ÿงช Validation

Create a Validator and run rules:

Check validity:

Custom messages:

Get errors:


๐Ÿงฉ Built-in Validation Rules

The plugin registers these rules automatically:

php Validator::register('starts_with', function ($value, $param) { return str_starts_with((string)$value, $param); }, "Value must start with '%s'.");



---

## ๐ŸŽจ View Helpers for Errors

### `error($field, Validator $validator)`

Outputs error messages wrapped in `<div class="error-msg">`.

### `has_error($field, $validator)`

Useful for conditional styling:

### `error_class($field, $validator)`

Returns `"error"` if the field has validation errors.

### `validator()`

Returns the Validator instance from the container:

### `is_post()`

Detects if the request method is POST.

---

## ๐Ÿ›ก๏ธ CSRF Protection

CSRF is enforced automatically for:

* POST
* PUT
* DELETE

unless an `Authorization` header exists.

Add the token to your form:

Invalid tokens immediately trigger a 400 response before controller execution.

---

## ๐Ÿ” Internals

The plugin automatically:

* Registers built-in validator rules via the container
* Hooks CSRF validation into `Event::CONTROLLER_CALLING`
* Extends the guard with a CSRF service
* Provides global view helpers for forms
* Uses `param()` to manage form memory state

All without configuration.

---

## ๐Ÿ“ Requirements

* `nixphp/framework` โ‰ฅ 0.1.0
* `nixphp/session` โ‰ฅ 0.1.0 (required for CSRF + memory)

---

## ๐Ÿ“„ License

MIT License.

All versions of form with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-mbstring Version *
nixphp/framework Version ^0.1.0
nixphp/session Version ^0.1.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 nixphp/form contains the following files

Loading the files please wait ...