PHPackages                             phpxhtml/phpxhtml - 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. phpxhtml/phpxhtml

ActiveLibrary

phpxhtml/phpxhtml
=================

A modern HTML Builder for PHP. Build complete HTML pages using PHP functions instead of mixing PHP and HTML.

V1.0(today)01↑2900%MITPHP

Since Jul 27Pushed todayCompare

[ Source](https://github.com/israel-007/phpxhtml)[ Packagist](https://packagist.org/packages/phpxhtml/phpxhtml)[ RSS](/packages/phpxhtml-phpxhtml/feed)WikiDiscussions main Synced today

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

PHPXHTML
========

[](#phpxhtml)

A modern HTML builder for PHP. Build complete HTML pages using PHP functions instead of mixing PHP and HTML.

```
html(function () {

    head(function () {
        title("Welcome");
    });

    body(function () {

        div(['class' => 'container'], function () {

            h1("Hello World");

            p("This page was built entirely using PHP.");

            a(['href' => '/about'], "Learn More");

        });

    });

});

render();
```

**Philosophy:** developers should never have to close PHP just to write HTML. Everything is generated through PHP function calls, into an in-memory tree, which is only turned into a string when you're ready to output it.

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

[](#requirements)

- PHP 8.3+
- Composer

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

[](#installation)

```
composer require phpxhtml/phpxhtml
```

Quick start
-----------

[](#quick-start)

```
