定制 momentumstudio/laravel-theme 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

momentumstudio/laravel-theme

Composer 安装命令:

composer require momentumstudio/laravel-theme

包简介

Allows developers to split views into multiple, switchable themes.

README 文档

README

Logo Image

Laravel Theme

This project is licensed MIT.

Laravel Theme by Momentum Studio is a package that allows the developer to create multiple sets of templates that can be switched at runtime. Allowing for users to set their own theme, or simply for trying out a new theme to a select few users.

  • Adds your theme path to Laravel's default ViewFinder, making sure it can support other theme-related packages.
  • Uses a simple Facade to set your current theme.
  • Config overridable via environment variables or your own config file.

Installation & Usage

Requires

Use Composer to install Laravel Theme as a dependency into your Laravel project:

composer require momentumstudio/laravel-theme

The package will automatically register itself. You can publish the config file with:

php artisan vendor:publish --provider="MomentumStudio\LaravelTheme\LaravelThemeServiceProvider"

Alternatively, you can just set the environment variables in your .env file:

DEFAULT_THEME=default
THEMES_PATH=themes

This is the contents of the default configuration file:

return [

    /**
     * Set default theme to be chosen on startup
     * Set to `null` to use default views (resources/views)
     */
    'default' => env('DEFAULT_THEME', null),

    /**
     * Set the base directory to find themes
     */
    'path' => env('THEMES_PATH', base_path('themes')),
];

You can set default to null to keep using resources/views until you set otherwise at runtime. Good for importing this package into existing projects.

Then, to set a theme during runtime, call the provided Facade's set method:

\MomentumStudio\LaravelTheme\Facades\Theme::set('directory-name');

This will then search your themes path for templates matching the name when calling Laravel's view() (or equivalent).

For example, setting my theme to mytheme and calling view('my-view') will search themes/mytheme/my-view.blade.php first before reverting to resources/views/my-view.blade.php.

Contributing

Please see CONTRIBUTING.md for details about how you can help!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固