PHPackages                             ferndev/phpprogrammingcontrols - 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. ferndev/phpprogrammingcontrols

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

ferndev/phpprogrammingcontrols
==============================

Modern, secure, and flexible programming controls library for PHP 8.0+

v1.0.0(7mo ago)00MITPHPPHP &gt;=8.0

Since Oct 18Pushed 7mo agoCompare

[ Source](https://github.com/ferndev/phpprogrammingcontrols)[ Packagist](https://packagist.org/packages/ferndev/phpprogrammingcontrols)[ Docs](https://github.com/ferndev/phpprogrammingcontrols)[ RSS](/packages/ferndev-phpprogrammingcontrols/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

phpprogrammingcontrols (PHP 8.0+ Edition)
=========================================

[](#phpprogrammingcontrols-php-80-edition)

This project makes common html controls easily available from PHP, for you to use on any website. They provide a way to create php-based compact, re-usable and easier to maintain code for your web projects.
It also provides a simple mechanism to easily create new html controls in PHP.
These controls do not depend on any PHP Framework, or frontend library, but can be used with any of them, or standalone on a website or script created from scratch.

New in PHP 8.0+ Edition
-----------------------

[](#new-in-php-80-edition)

- **Strict types** for improved performance and error detection
- **Complete type safety** with parameter and return type declarations
- **XSS protection** with automatic HTML escaping
- **JSON serialization** support with JsonSerializable interface
- **Modern PHP 8.0+ syntax** including match expressions and nullable types
- **Enhanced security** with proper input validation
- **Improved error handling** with specific exception types

License
=======

[](#license)

PHPProgrammingControls is licensed under the MIT License.

Installation and usage
======================

[](#installation-and-usage)

The controls require PHP 8.0 or higher. To get started, simply clone this folder and run composer install in your local environment, or use [Composer](https://getcomposer.org/) to download and install the library. Then execute index.php in your local server/browser and take a look at the provided samples.

Adding the library to your own project
--------------------------------------

[](#adding-the-library-to-your-own-project)

You can add the library to your own project with composer, by adding the following entries to your composer.json file:
"require": {
"php": "&gt;=8.0",
"ferndev/phpprogrammingcontrols": "\*"
},
If composer gives you an error or warning about stability, add the following as well:
"minimum-stability": "dev".
If you are not using composer then you will need to add the source folder: "src" to your own project, and "use" the controls you need (look at the code of the provided examples).
You can then start creating instances of the controls.

Migration from earlier versions
-------------------------------

[](#migration-from-earlier-versions)

See `UPGRADE_PHP8.md` for detailed migration instructions and breaking changes.

Features
--------

[](#features)

- **Type-safe** HTML control creation
- **XSS protection** built-in
- **Fluent interface** for method chaining
- **JSON serialization** support
- **Framework agnostic** - works with any PHP framework
- **Frontend agnostic** - works with any CSS framework

HtmlTabs quick guide
--------------------

[](#htmltabs-quick-guide)

HtmlTabs renders a tab strip and associated panes using framework-agnostic APIs. Choose your frontend mode and the control will emit appropriate classes and behavior.

Key API:

- addTab(string $title, string $contentLink, bool $isActive = false): adds a tab targeting a pane id like `#pane1`.
- setTabContent(string $paneId, HtmlBase $content): registers the content for the given pane id (without `#`).
- setFramework('bootstrap' | 'tailwind' | 'react' | 'vanilla'): selects sensible defaults for each mode.
- setClasses(array $overrides): override any defaults (ulClass, liClass, linkClass, linkActiveClass, contentContainerClass, paneClass, paneActiveClass, paneHiddenClass).
- enableClientToggle(bool): enable/disable the built-in tiny toggler (used in tailwind/vanilla; not used in bootstrap/react modes).

Bootstrap example:

```
$tabs = (new HtmlTabs())->setFramework('bootstrap');
$tabs->addTab('Tab1', '#p1', true)->addTab('Tab2', '#p2');
$tabs->setTabContent('p1', new HtmlDiv('Tab1 content...'));
$tabs->setTabContent('p2', new HtmlDiv('Tab2 content...'));
// include Bootstrap CSS/JS
```

Tailwind example (no Bootstrap JS):

```
$tabs = (new HtmlTabs())->setFramework('tailwind'); // includes tiny built-in toggler
$tabs->addTab('Tab1', '#p1', true)->addTab('Tab2', '#p2');
$tabs->setTabContent('p1', new HtmlDiv('Tab1 content...'));
$tabs->setTabContent('p2', new HtmlDiv('Tab2 content...'));
```

React example (server renders HtmlTabs, React binder wires toggling):

```
$tabs = (new HtmlTabs('react-tabs'))->setFramework('react');
$tabs->addTab('Tab1', '#p1', true)->addTab('Tab2', '#p2');
$tabs->setTabContent('p1', new HtmlDiv('Tab1 content...'));
$tabs->setTabContent('p2', new HtmlDiv('Tab2 content...'));
// load examples/js/react-tabs-binder.jsx with React + Babel
```

Vanilla example (no frameworks, your classes):

```
$tabs = (new HtmlTabs('my-tabs'))->setFramework('vanilla')->setClasses([
  'ulClass' => 'tabs',
  'linkClass' => 'tab',
  'linkActiveClass' => 'tab--active',
  'paneHiddenClass' => 'hidden'
]);
$tabs->addTab('One', '#p1', true)->addTab('Two', '#p2');
$tabs->setTabContent('p1', new HtmlDiv('One'));
$tabs->setTabContent('p2', new HtmlDiv('Two'));
```

See examples:

- Bootstrap: `examples/TabsExample.php`
- Tailwind: `examples/TabsExampleTailwind.php`
- React: `examples/TabsExampleReact.php` + `examples/js/react-tabs-binder.jsx`

Examples and assets
-------------------

[](#examples-and-assets)

- All examples now use CDN-hosted assets (Bootstrap 5, Tailwind CSS, React 18, Babel) with integrity and crossorigin where applicable.
- Legacy local assets under `examples/css` and `examples/fonts` have been removed. Examples no longer depend on local Bootstrap 3 or Glyphicons.
- Entry point `index.php` redirects to `examples/landing.php`, which links to all demos (Bootstrap/Tailwind/React variants).
- React examples load JSX from `examples/js/*.jsx` and rely on in-browser Babel transform for convenience.

### Try the demos locally

[](#try-the-demos-locally)

- Serve the project with your PHP web server (Apache, Nginx, or PHP’s built-in server) and open:
    - `examples/landing.php` for the main showcase
    - Or directly: `examples/SampleWebControls.php`, `examples/SampleWebControlsTailwind.php`, `examples/SampleWebControlsReact.php`, etc.

### Run tests

[](#run-tests)

- Requires Composer dependencies installed.
- From the project root, run:

```
composer install
vendor\bin\phpunit.bat --colors=never tests
```

All tests should pass (40 tests, 152 assertions).

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

213d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6b47aed290646ab26bdc511ae81ad631470f02a9c35e12bfbecceb0f1b7a483?d=identicon)[ferndev](/maintainers/ferndev)

---

Top Contributors

[![ferndev](https://avatars.githubusercontent.com/u/4785262?v=4)](https://github.com/ferndev "ferndev (2 commits)")

---

Tags

html controlsphp development

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ferndev-phpprogrammingcontrols/health.svg)

```
[![Health](https://phpackages.com/badges/ferndev-phpprogrammingcontrols/health.svg)](https://phpackages.com/packages/ferndev-phpprogrammingcontrols)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
