php-lion/theme-sb-admin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

php-lion/theme-sb-admin

Composer 安装命令:

composer require 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

README 文档

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

php-lion/theme-sb-admin 适用场景与选型建议

php-lion/theme-sb-admin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「symfony」 「admin」 「theme」 「bootstrap」 「bundle」 「dashboard」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 php-lion/theme-sb-admin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 php-lion/theme-sb-admin 我们能提供哪些服务?
定制开发 / 二次开发

基于 php-lion/theme-sb-admin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-28