phpxui
Version:
A package for generating Prisma PHP components with a CLI interface.
137 lines (90 loc) • 4.18 kB
Markdown
# **phpxui‑cli** — Instant PHPXUI Component Generator 🚀
> **Generate fully‑typed PHPXUI components for Prisma PHP right from the terminal.**
> ⚡ **Single component** → `npx phpxui add Alert` | 🌌 **Whole library** → `npx phpxui add --all`
---
## ✨ Features
| Feature | Details |
| --------------------- | ------------------------------------------------------------------------------------------------------------ |
| **Bulk install** | `--all` downloads every component in one shot. |
| **Ready‑to‑use code** | Each file already contains the `$class` merge logic and `{$attributes}` placeholder for **Wave** reactivity. |
| **Clean paths** | Files are written under `src/Lib/PHPXUI/FancyName.php` with OS‑agnostic separators. |
| **Friendly output** | Clear green / red summary with relative paths only. |
| **Automatic icons** | Core **PPIcons** (`x`, `chevron‑down`, `chevron‑right`) are installed on the very first run. |
---
## 📦 Installation
```bash
# 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
```bash
# 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
```
CLI output example:
```bash
📦 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 generated file looks like this:
```php
<?php
namespace Lib\PHPXUI;
use Lib\PHPX\PHPX;
class Alert extends PHPX
{
public function render(): string
{
$attributes = $this->getAttributes();
$class = $this->getMergeClasses();
return <<<HTML
<div {$attributes} class="alert {$class}">
{$this->children}
</div>
HTML;
}
}
```
---
## 🔧 CLI Options
| Flag / Argument | Description |
| --------------- | -------------------------------------------------------- |
| `<component …>` | One or more component names separated by space or comma. |
| `--all` | Download the full catalogue in one request. |
| `--force` | Overwrite existing files. |
> **Note:** The CLI automatically installs a default set of core icons (such as `x`, `chevron-down`, `chevron-right`) on first use. Extra icons are not yet selectable via `phpxui` directly.
---
## 🎨 Using Additional Icons
Need more icons? Use the **PPIcons** CLI directly:
```bash
npx ppicons add menu chevron-left arrow-right
```
This will place the requested icons under `src/Lib/PPIcons` with full PHPXUI typings.
Browse the complete icon catalogue and usage docs at **[https://ppicons.tsnc.tech/](https://ppicons.tsnc.tech/)**.
---
## 📚 Documentation
Full guides and examples live at the [PHPXUI documentation site](https://phpxui.tsnc.tech/).
---
## 💡 Contributing
We welcome contributions to improve **phpxui‑cli**. If you have ideas, find bugs, or want to add features, open an issue or submit a pull request.
---
## 📄 License
`phpxui‑cli` is released under the MIT License. See `LICENSE` for details.
---
## 👤 Author
This project is developed and maintained by **The Steel Ninja Code**, continuously pushing the boundaries of PHP development.
---
## 📧 Contact
Questions or feedback? Reach us at [thesteelninjacode@gmail.com](mailto:thesteelninjacode@gmail.com) — we’d love to hear from you!