PHPackages                             jaypha/jayponents - 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. jaypha/jayponents

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

jaypha/jayponents
=================

Construct documents with heirarchical components

v0.1.4(6y ago)0923BSL-1.0PHPPHP ^7.1

Since Jan 30Pushed 6y agoCompare

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

READMEChangelogDependencies (1)Versions (6)Used By (3)

Jayponents
==========

[](#jayponents)

Written by Jason den Dulk

Construct documents with heirarchical components.

### Features

[](#features)

- Usable with any template engine via adaptors. Uses PHP by default.
- Hierarchical. Components can be added to other Components to create docuemnts of arbitrary complexity. No need for partials, layouts or helpers as `Component` can be used for all of these roles.
- You can create custom component classes that allow you to have extra, specific business logic that can be kept out of the template, or handle boilerplate you dont want to have repeated in every template file.

Requirements
------------

[](#requirements)

PHP v7.1.0 or greater.

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

[](#installation)

```
composer require jaypha/jayponents

```

API
---

[](#api)

### class Component

[](#class-component)

`static void setDefaultEngine(TemplateEngineAdaptor $a)`

Sets the default template engine. If none is provided, then PHP will be used.

`void setEngine(TemplateEngineAdaptor $a)`

Sets the template engine to be used for this component. If none is set, then the default engine set via `setDefaultEngine` will be used.

`void setTemplate(string $template = null)`

Sets the template file or string (if possible)

`void setVars(array $values)`

Sets all the values.

`void set(string $name, mixed $value)`

Sets a single value

`void remove(string $name)`

Removes a value stored under $name.

`void add(mixed $value)`

Adds a value without a name. Useful when no template is being used.

`void clear()`

Removes all values.

`void display()`

Prints the contents directly to the output.

`string __toString()`

Returns the contents as a string.

### class PhpFileAdaptor

[](#class-phpfileadaptor)

Adaptor to use PHP itself as the template engine.

### class PhpTextAdaptor

[](#class-phptextadaptor)

Adaptor to allow the PHP template to be passed directly as a string.

#### class TextComponent

[](#class-textcomponent)

Behaves the same as `Component` except that the template is provided directly instead of via a file.

License
-------

[](#license)

Copyright (C) 2017-8 Jaypha.
Distributed under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

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

Every ~36 days

Total

5

Last Release

2517d ago

PHP version history (2 changes)v0.1.0PHP ^5.4 || ^7

v0.1.3PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ca39c239f426fd20c6348188dc7cf2b2ff3783ebb5d44bd886572a8ec53b24f?d=identicon)[jaypha](/maintainers/jaypha)

---

Top Contributors

[![jaypha](https://avatars.githubusercontent.com/u/1052990?v=4)](https://github.com/jaypha "jaypha (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jaypha-jayponents/health.svg)

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

###  Alternatives

[yahnis-elsts/admin-notices

A utility library for WordPress plugins that makes it easier to create admin notices. Supports persistently dismissible notices.

311.1k](/packages/yahnis-elsts-admin-notices)[jahvi/magento2-copy-theme-override

Magento 2 command to automatically copy files into active theme

124.5k](/packages/jahvi-magento2-copy-theme-override)

PHPackages © 2026

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