PHPackages                             tina4stack/tina4php-shape - 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. tina4stack/tina4php-shape

ActiveLibrary

tina4stack/tina4php-shape
=========================

Tina4 PHP HTML Shape Language

v2.0.4(2mo ago)37.2k↓18.2%22MITPHPPHP &gt;=8.1CI passing

Since Jul 3Pushed 2mo ago2 watchersCompare

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

READMEChangelog (4)Dependencies (6)Versions (7)Used By (2)

tina4php-shape
==============

[](#tina4php-shape)

HTML Language called Shape where you write code to make HTML

### Installation

[](#installation)

```
composer require tina4stack/tina4php-shape
```

### Basic usage

[](#basic-usage)

Each HTML tag has an underscore prefix, `` tag would be `_p()`

#### Normal Tag

[](#normal-tag)

```
echo _p("Hello"); //Hello
```

#### Tag with Attributes

[](#tag-with-attributes)

```
echo _div(["class" => "form-group"], "Testing"); //Testing
```

#### Nesting of tags

[](#nesting-of-tags)

Some things become easier to code due to nesting, think of un ordered lists or select tags.

```
$lis = [];

$lis[] = _li("One");
$lis[] = _li("Two");

$ul = _ul ($lis);

$options = [];

$options[] = _option("One");
$options[] = _option("Two");

$select = _select (["name" => "choose"], $options);
```

#### Finding a tag by id

[](#finding-a-tag-by-id)

Sometimes you want to manipulate a tag's content, so we find it based on the id attribute.

```
$tag = $html->byId("someId");
```

#### Set the html of a tag

[](#set-the-html-of-a-tag)

```
$tag->html(_p("Changed HTML"));
```

### Example

[](#example)

```
