php-lion/theme-sb-admin

PhpLion Theme - Start Bootstrap SB Admin - A Symfony bundle providing the Start Bootstrap SB Admin template as a ready-to-use admin dashboard

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:symfony-bundle

pkg:composer/php-lion/theme-sb-admin

0.1.0 2025-10-28 08:56 UTC

This package is not auto-updated.

Last update: 2025-10-29 06:19:02 UTC


README

A Symfony bundle providing the Start Bootstrap SB Admin theme as a ready-to-use admin dashboard template.

Description

This bundle integrates the popular SB Admin template into Symfony applications, offering a clean and modern Bootstrap 5-based admin interface with responsive design, sidebar navigation, and comprehensive example pages.

Features

  • Modern Admin Dashboard - Clean, professional Bootstrap 5 admin interface
  • Responsive Design - Fully responsive layout for mobile, tablet, and desktop
  • Sidebar Navigation - Collapsible sidebar with hierarchical menu structure
  • Pre-built Pages - Ready-to-use pages for common admin scenarios
  • FontAwesome Icons - Comprehensive icon set included
  • Symfony Integration - Seamless integration with Symfony's Asset Mapper
  • Navigation Attributes - Automatic menu generation using PHP attributes

Requirements

  • PHP >= 8.3
  • Symfony >= 6.4 or 7.0+
  • Composer

Installation

composer require php-lion/theme-sb-admin

Configuration

1. Register the Bundle

The bundle should be automatically registered via Symfony Flex. If not, add it to config/bundles.php:

return [
    // ...
    PhpLion\Theme\SbAdminBundle\PhpLionSbAdminBundle::class => ['all' => true],
];

2. Compile Assets

php bin/console asset-map:compile

Demo Pages (Optional)

The bundle includes example pages to showcase the theme. To enable them, add the bundle routes to your config/routes.yaml:

phplion_theme_sb_admin:
    resource: '@PhpLionSbAdminBundle/config/routes.yaml'

All demo pages will then be accessible under the /_phplion/theme/sb_admin prefix:

Core Pages

  • / - Dashboard (Main admin page with stats cards and tables)
  • /charts - Charts page with Chart.js examples
  • /tables - Data tables page with sample data

Layout Examples

  • /layout_static - Static navigation demo
  • /layout_sidenav_light - Light sidebar theme demo

Authentication Pages

  • /login - Login page
  • /register - Registration page
  • /password - Password recovery page

Error Pages

  • /error_401 - 401 Unauthorized page
  • /error_404 - 404 Not Found page
  • /error_500 - 500 Internal Server Error page

Usage

Using the Base Template

Extend the base template in your own Twig files:

{% extends '@PhpLionSbAdmin/base.html.twig' %}

{% block content %}
    <h1 class="mt-4">My Admin Page</h1>
    <div class="card mb-4">
        <div class="card-body">
            Your content here
        </div>
    </div>
{% endblock %}

Navigation System

The bundle uses PHP attributes for automatic navigation generation:

use PhpLion\NavigationBundle\Attribute\Navigation;
use PhpLion\NavigationBundle\Attribute\NavigationGroup;

#[NavigationGroup(name: '_phplion_theme_sb_admin')]
class MyAdminController extends AbstractController
{
    #[Route('/my-page', name: 'my_admin_page')]
    #[Navigation(path: 'My Section|My Page', priority: 1000)]
    public function myPage(): Response
    {
        return $this->render('@PhpLionSbAdmin/page/custom.html.twig');
    }
}

Template Blocks

Available blocks for customization:

  • title - Page title
  • stylesheets - Additional CSS files
  • body_class - Body CSS classes
  • navbar - Top navigation bar
  • sidebar - Side navigation
  • content - Main content area
  • footer - Footer section
  • javascripts - Additional JavaScript files

Asset Structure

assets/
├── css/
│   └── styles.css          # Main theme stylesheet
├── js/
│   ├── scripts.js          # Theme JavaScript (sidebar toggle, etc.)
│   └── datatables-simple-demo.js
├── fonts/                  # Custom fonts
├── images/                 # Theme images
└── vendor/                 # Third-party assets

Template Structure

templates/
├── base.html.twig          # Base layout with sidebar and navbar
└── page/
    ├── index.html.twig     # Dashboard
    ├── charts.html.twig    # Charts page
    ├── tables.html.twig    # Tables page
    ├── login.html.twig     # Login page
    ├── register.html.twig  # Registration page
    ├── password.html.twig  # Password recovery
    ├── 401.html.twig       # 401 error
    ├── 404.html.twig       # 404 error
    ├── 500.html.twig       # 500 error
    ├── layout-static.html.twig
    └── layout-sidenav-light.html.twig

Customization

Override Templates

Create your own templates in templates/bundles/PhpLionSbAdminBundle/:

templates/
└── bundles/
    └── PhpLionSbAdminBundle/
        └── base.html.twig  # Your customized base template

Custom Styling

Add your own CSS after the theme's stylesheet:

{% block stylesheets %}
    {{ parent() }}
    <link href="{{ asset('css/my-custom-admin.css') }}" rel="stylesheet" />
{% endblock %}

Sidebar Customization

Override the sidebar block to customize the navigation:

{% extends '@PhpLionSbAdmin/base.html.twig' %}

{% block sidebar %}
    {# Your custom sidebar #}
{% endblock %}

License

MIT License - see LICENSE file for details

Credits

Support

For issues and questions:

Original Template

This bundle is based on the SB Admin template by Start Bootstrap, licensed under the MIT License. The original template can be found at: https://startbootstrap.com/template/sb-admin