amsiam/lara-ui-cli

CLI tool for installing LaraUI components in Laravel projects

Maintainers

Package info

github.com/Amsiam/lara-ui-cli

pkg:composer/amsiam/lara-ui-cli

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-01-29 05:13 UTC

This package is auto-updated.

Last update: 2026-03-01 00:48:55 UTC


README

A CLI tool for adding LaraUI components to your Laravel project. Similar to shadcn/ui CLI, this tool fetches components from the LaraUI registry and installs them directly into your project.

Installation

composer require amsiam/lara-ui-cli --dev

Quick Start

1. Initialize your project

php artisan ui:init

This will:

  • Create a lara-ui.json configuration file
  • Install CSS variables to resources/css/lara-ui.css
  • Update your app.css to import the styles

2. Add components

# Add specific components
php artisan ui:add button card input

# Add all components
php artisan ui:add all

# Interactive selection
php artisan ui:add

3. Use components

<x-ui::button variant="primary">Click me</x-ui::button>

<x-ui::card>
    <x-ui::card-header>
        <x-ui::card-title>Hello</x-ui::card-title>
    </x-ui::card-header>
    <x-ui::card-content>
        Content here
    </x-ui::card-content>
</x-ui::card>

Commands

ui:init

Initialize LaraUI in your project.

php artisan ui:init [--force] [--yes] [--registry=]
Option Description
--force Overwrite existing configuration
--yes Skip prompts, use defaults
--registry= Custom registry URL (default: GitHub)

Examples:

# Default initialization (uses official LaraUI registry)
php artisan ui:init

# Use custom registry
php artisan ui:init --registry=https://your-domain.com/components

# Quick setup with defaults
php artisan ui:init --yes

# Custom registry with defaults
php artisan ui:init --yes --registry=http://localhost:8000/packages/laraui

ui:add

Add components to your project.

php artisan ui:add [components...] [--all] [--force] [--deps] [--path=]
Option Description
--all Install all available components
--force Overwrite existing files
--deps Skip dependency installation
--path= Custom installation path

Examples:

# Add specific components
php artisan ui:add button card dialog

# Add all components
php artisan ui:add all

# Interactive multi-select
php artisan ui:add

# Force overwrite existing
php artisan ui:add button --force

# Custom path
php artisan ui:add button --path=resources/ui

ui:list

List available components.

php artisan ui:list [--category=] [--installed] [--available] [--json] [--refresh]
Option Description
--category= Filter by category (core, forms, feedback, etc.)
--installed Show only installed components
--available Show only not-installed components
--json Output as JSON
--refresh Refresh the registry cache

ui:diff

Check for updates to installed components.

php artisan ui:diff [component] [--all]
Option Description
component Specific component to check
--all Check all installed components

Configuration

After running ui:init, a lara-ui.json file is created in your project root:

{
    "registry": "https://raw.githubusercontent.com/amsiam/lara-ui/main",
    "aliases": {
        "components": "resources/views/components/ui",
        "utils": "app/View/Components/LaraUi"
    },
    "tailwind": {
        "css": "resources/css/app.css"
    },
    "prefix": "ui"
}

Configuration Options

Key Description Default
registry URL of the component registry GitHub raw URL
aliases.components Where Blade views are installed resources/views/components/ui
aliases.utils Where PHP classes are installed app/View/Components/LaraUi
tailwind.css Path to your main CSS file resources/css/app.css
prefix Component prefix (e.g., x-ui::) ui

Custom Registry

You can host your own component registry by setting the registry URL:

{
    "registry": "https://your-domain.com/lara-ui"
}

The registry must have a registry.json file and the component files at the expected paths.

How It Works

  1. Initialization (ui:init)

    • Creates configuration file
    • Downloads CSS variables from registry
    • Sets up your project for LaraUI
  2. Adding Components (ui:add)

    • Fetches component files from the registry (GitHub)
    • Resolves and installs dependencies automatically
    • Transforms namespaces and prefixes for your project
    • Copies files to your configured paths
  3. Component Ownership

    • Components are copied to your project
    • You own and can customize them fully
    • No runtime dependency on the registry

Requirements

  • PHP 8.2+
  • Laravel 11 or 12
  • Tailwind CSS 4
  • Alpine.js 3.x (for interactive components)

Dependencies

After installing components, ensure you have these packages:

# Required for class merging
composer require gehrisandro/tailwind-merge-laravel

License

MIT License