php-admin/README.md

114 lines
2.4 KiB
Markdown
Raw Normal View History

2026-01-26 20:56:28 +00:00
# Core Admin Package
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
Admin panel components, Livewire modals, and service management interface for the Core PHP Framework.
2026-01-26 20:48:24 +00:00
## Installation
```bash
2026-01-26 20:56:28 +00:00
composer require host-uk/core-admin
```
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
## Features
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
### Admin Menu System
Declarative menu registration with automatic permission checking:
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
```php
use Core\Front\Admin\Contracts\AdminMenuProvider;
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
class MyModuleMenu implements AdminMenuProvider
{
public function registerMenu(AdminMenuRegistry $registry): void
{
$registry->addItem('products', [
'label' => 'Products',
'icon' => 'cube',
'route' => 'admin.products.index',
'permission' => 'products.view',
]);
}
}
2026-01-26 20:48:24 +00:00
```
2026-01-26 20:56:28 +00:00
### Livewire Modals
Full-page Livewire components for admin interfaces:
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
```php
use Livewire\Component;
use Livewire\Attributes\Title;
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
#[Title('Product Manager')]
class ProductManager extends Component
{
public function render(): View
{
return view('admin.products.manager')
->layout('hub::admin.layouts.app');
}
}
2026-01-26 20:48:24 +00:00
```
2026-01-26 20:56:28 +00:00
### Form Components
Reusable form components with authorization:
- `<x-forms.input>` - Text inputs with validation
- `<x-forms.select>` - Dropdowns
- `<x-forms.checkbox>` - Checkboxes
- `<x-forms.toggle>` - Toggle switches
- `<x-forms.textarea>` - Text areas
- `<x-forms.button>` - Buttons with loading states
```blade
<x-forms.input
name="name"
label="Product Name"
wire:model="name"
required
/>
2026-01-26 20:48:24 +00:00
```
2026-01-26 20:56:28 +00:00
### Global Search
Extensible search provider system:
2026-01-26 20:48:24 +00:00
```php
2026-01-26 20:56:28 +00:00
use Core\Admin\Search\Contracts\SearchProvider;
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
class ProductSearchProvider implements SearchProvider
2026-01-26 20:48:24 +00:00
{
2026-01-26 20:56:28 +00:00
public function search(string $query): array
2026-01-26 20:48:24 +00:00
{
2026-01-26 20:56:28 +00:00
return Product::where('name', 'like', "%{$query}%")
->take(5)
->get()
->map(fn($p) => new SearchResult(
title: $p->name,
url: route('admin.products.edit', $p),
icon: 'cube'
))
->toArray();
2026-01-26 20:48:24 +00:00
}
}
```
2026-01-26 20:56:28 +00:00
### Service Management Interface
Unified dashboard for viewing workspace services and statistics.
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
## Configuration
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
The package auto-discovers admin menu providers and search providers from your modules.
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
## Requirements
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
- PHP 8.2+
- Laravel 11+ or 12+
- Livewire 3.0+
- Flux UI 2.0+
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
## Changelog
2026-01-26 20:48:24 +00:00
2026-01-26 20:56:28 +00:00
See [changelog/2026/jan/features.md](changelog/2026/jan/features.md) for recent changes.
2026-01-26 20:48:24 +00:00
## License
2026-01-26 20:56:28 +00:00
EUPL-1.2 - See [LICENSE](../../LICENSE) for details.