PHPackages                             flsouto/htfield - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. flsouto/htfield

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

flsouto/htfield
===============

Base class for implementing all kinds of form fields, both widgets and non-widgets

1.0.3(9y ago)12033PHP

Since Jan 21Pushed 9y agoCompare

[ Source](https://github.com/flsouto/htfield)[ Packagist](https://packagist.org/packages/flsouto/htfield)[ RSS](/packages/flsouto-htfield/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (5)Used By (3)

HtField
=======

[](#htfield)

Overview
--------

[](#overview)

The HtField class is a base class for implementing all kinds of form fields, both widgets and non-widgets. It is basically a wrapper for two things:

- parameter resolution
- tag attribute setting

For understanding these concepts more deeply I recommend you take a look at the two underlying libraries being used by this class:

- [FlSouto\\Param](https://github.com/flsouto/param/)
- [FlSouto\\HtAttrs](https://github.com/flsouto/htattrs)

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

[](#installation)

Install this library via composer

```
composer require flsouto/htfield

```

Usage
-----

[](#usage)

As this is an abstract class, it is only useful if you want to build your own form field types. Therefore in this document I will show you how you can extend it in order to implement a very simple widget.

### Defining a Simple Widget

[](#defining-a-simple-widget)

Our example widget is going to be poor in functionality but will be enough for demonstrating the base API. We are going to call it 'MyField'. See its definition below:

```
