PHPackages                             broeser/feeld - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. broeser/feeld

ActiveLibrary

broeser/feeld
=============

Feeld provides typed field objects that can be used as building blocks to create CLI questionnaires, HTML forms, and much more. Includes sanitization and validation.

113PHP

Since Feb 19Pushed 10y ago1 watchersCompare

[ Source](https://github.com/broeser/feeld)[ Packagist](https://packagist.org/packages/broeser/feeld)[ RSS](/packages/broeser-feeld/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Feeld
=====

[](#feeld)

/ This is a very early work-in-progress without any releases, hardly any tests and without proper documentation /

[![Build Status](https://camo.githubusercontent.com/5ef30e95121304f2711a386c568bf11deec0a3c91cff2d532f84346f823af0ab/68747470733a2f2f7472617669732d63692e6f72672f62726f657365722f6665656c642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/broeser/feeld)[![codecov.io](https://camo.githubusercontent.com/da88d2a443f3ce8ff7d1b5b488d8a7e7a944c267a5b120b5a10b47c013c9a8cc/68747470733a2f2f636f6465636f762e696f2f6769746875622f62726f657365722f6665656c642f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/broeser/feeld?branch=master)[![License](https://camo.githubusercontent.com/e498eead712d82d9ee1af0a4850acd2e46ea48c48fb9ce5a3d2ab64f28f95b34/687474703a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6d69742d626c75652e737667)](http://mit-license.org)[![SemVer 2.0.0](https://camo.githubusercontent.com/80a092585308866a22318249288bb79a8841799ea528d3dacfc53bdfb8e23ecf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73656d7665722d322e302e302d626c75652e737667)](http://semver.org/spec/v2.0.0.html)

Feeld provides typed field objects that can be used as building blocks to create the data model for CLI questionnaires, HTML forms, and much more. Includes sanitization and validation and example UI implementations.

Goals
-----

[](#goals)

- Feeld aims for a strict separation between data model and display, it should be possible to display the same fields in HTML, GTK or the CLI with minimal changes to your code
- Feeld aims to be reasonably extensible with your own DataTypes, Field types, Displays (UI components) and other enhancements
- Feeld should be as easy to learn and as easy to use as possible without loosing flexibility

Note
----

[](#note)

If your are only interested in the "sanitization and validation" aspect of Feeld and not in predefined data types and form building blocks, it might be a better choice to use broeser/sanitor and broeser/wellid – both packages are a little bit easier to use then Feeld.

Installation
------------

[](#installation)

Feeld works with PHP 5.6 and 7.0.

The package can be installed via composer:

`composer require broeser/feeld`

How to use
----------

[](#how-to-use)

### DataTypes *– A wrapper around sanitization and validation*

[](#datatypes--a-wrapper-around-sanitization-and-validation)

A DataType is a combination of a default sanitizer, default validators and some basic methods to specify boundaries (e.g. setMinLength() and setMaxLength()).

These DataTypes are supplied with Feeld in the src/DataType-directory:

- Boolean
- Country
- Date
- Email
- File
- FloatingPoint
- Integer
- Str (String)
- URL

#### Sanitization and validation with data types

[](#sanitization-and-validation-with-data-types)

A value can be sanitized and validated by using data types.

Example:

```
