Home

phpxui-cli — Instant PHPXUI Component Generator 🚀

Generate fully-typed PHPXUI components for Prisma PHP right from the terminal.
npx phpxui add Alert   |   🌌 npx phpxui add --all   |   🔁 npx phpxui update


✨ Features

Feature Details
Bulk install Use --all to download all components in one request.
Update in place Run phpxui update to scan your installed components in outputDir and re-download them (overwrite) so you stay in sync with the latest templates.
Ready-to-use code Files include $class merge logic and {$attributes} for Wave reactivity.
Clean paths Components are saved in src/Lib/PHPXUI/.
Friendly output Clear green/red terminal feedback with relative paths.
Automatic icons Core PPIcons (x, chevron-down, chevron-right) install automatically on first run.
Cross-platform Works on Windows, macOS and Linux.

📦 Installation

# Global
npm install -g phpxui

# Or as a dev-dependency
npm install -D phpxui
  

Requires Node 18+ and a Prisma PHP project (PHP 8.2+).


🚀 Quick Start

# Add a single component
npx phpxui add Alert

# Add multiple components at once
npx phpxui add Alert Dialog Badge

# Add the entire component set
npx phpxui add --all
  

Example CLI output (first run installs icons automatically):

📦 Installing ppicons CLI…
✨ Installing default icons: x chevron-down chevron-right
✔ Icons installed in src/Lib/PPIcons

✔ Alert   → src/Lib/PHPXUI/Alert.php
✔ Dialog  → src/Lib/PHPXUI/Dialog.php
✔ Badge   → src/Lib/PHPXUI/Badge.php
  

Each component will look like this:

<?php

namespace Lib\PHPXUI;

use Lib\PHPX\PHPX;

class Alert extends PHPX
{
    public ?string $class = '';
    public mixed $children = null;

    public function render(): string
    {
        $class = $this->getMergeClasses();
        $attributes = $this->getAttributes([
            'class' => $class,
        ]);

        return <<<HTML
        <div {$attributes}>
            {$this->children}
        </div>
        HTML;
    }
}

🔁 Updating Components

Use update when you want to refresh everything you already installed—perfect after new PHPXUI releases or template improvements.

# Update everything already installed (recommended)
npx phpxui update
    

What update does:

  • Loads your project config (ex: phpxui.json if present).
  • Resolves outputDir (default: src/Lib/PHPXUI).
  • Scans that folder for *.php component files (ex: Alert.php, Dialog.php).
  • Re-downloads the matching components from the PHPXUI catalogue.
  • Overwrites files automatically (no --force required for update).

Want to refresh just one component instead?

# Update one component (targeted)
npx phpxui add Alert --force
    

🔧 CLI Options

Commands

Command Description
add Generate one or more components by name, or use --all to generate the full catalogue.
update Scan installed components in outputDir and re-download them (overwrite) to refresh to the latest templates.

Flags / Arguments

Flag / Argument Description
<component …> One or more component names separated by space or comma (used with add).
--all Download the full catalogue in one request (used with add).
--force Overwrite existing files (used with add).

🎨 Using Additional Icons

Need more icons? Use the PPIcons CLI directly:

npx ppicons add menu chevron-left arrow-right
    

Browse the complete catalogue and docs at ppicons.tsnc.tech.


💡 Contributing

We welcome contributions! Submit issues, improvements or feature suggestions via pull request.


📄 License

Licensed under the MIT License. See LICENSE file for details.


👤 Author

Created by The Steel Ninja Code — Empowering developers to build modern PHP applications faster.


📧 Contact

Reach out at thesteelninjacode@gmail.com — we’d love to hear from you!