Search by

astral-php / astral-template

astral-php

Layouts Tailwind (admin, marketing) et partials UI pour Astral MVC.

Package info

github.com/astral-php/astral-template

pkg:composer/astral-php/astral-template

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.0 2026-08-30 06:55 UTC

This package is auto-updated.

Last update: 2026-08-30 07:33:52 UTC


README

Layouts Tailwind (admin, marketing) et partials UI pour Astral MVC.

PHP Version

Compatibilité

  • PHP: ^8.1 (8.1 → 8.5)
  • Astral MVC: ^1.1 (recommandé ≥ 1.1.3)

Installation

composer require astral-php/astral-template

Dans config/dependencies.php :

use Astral\Template\TemplateServiceProvider;

return [
    // …
    TemplateServiceProvider::class,
];

Au premier chargement, le provider copie (sans écraser) :

  • views/layout/admin.php, views/layout/marketing.php
  • views/partials/astral-template/*.php

Usage

// Dans un contrôleur
$this->view->setLayout('admin');   // ou 'marketing'

return $this->render('mon/vue', [
    'title'    => 'Utilisateurs',
    'adminNav' => [
        ['href' => '/admin', 'label' => 'Dashboard'],
        ['href' => '/users', 'label' => 'Users'],
    ],
]);

Partials (via View)

<?= $viewEngine->partial('partials/astral-template/alert', [
    'type' => 'success',
    'message' => 'Enregistré.',
]) ?>

<?= $viewEngine->partial('partials/astral-template/page-header', [
    'heading' => 'Articles',
    'subtitle' => 'Liste complète',
    'actionLabel' => 'Nouveau',
    'actionHref' => '/articles/create',
]) ?>

<?= $viewEngine->partial('partials/astral-template/breadcrumb', [
    'items' => [
        ['label' => 'Admin', 'href' => '/admin'],
        ['label' => 'Users'],
    ],
]) ?>

<?= $viewEngine->partial('partials/astral-template/table', [
    'headers' => ['Nom', 'Email'],
    'rows' => [['Alice', 'a@example.com']],
]) ?>

<?= $viewEngine->partial('partials/astral-template/empty-state', [
    'title' => 'Aucun article',
    'message' => 'Créez votre premier contenu.',
    'actionLabel' => 'Créer',
    'actionHref' => '/articles/create',
]) ?>

Via la classe Template (package)

use Astral\Template\Template;

echo Template::partial('alert', ['message' => 'Hi', 'type' => 'info']);

Contenu

Fichier Rôle
layout/admin Sidebar + topbar back-office
layout/marketing Header + footer site vitrine
partials/alert Alerte info/success/warning/error
partials/breadcrumb Fil d’Ariane
partials/page-header Titre + CTA
partials/table Tableau simple
partials/empty-state État vide

Tests

composer install
composer test

Licence

MIT