View themes is a simple package to provide themed view support to Laravel.

Overview

Laravel View Themes

View themes is a simple package to provide themed view support to Laravel.

Installation

Add alexwhitman/view-themes to the require section of your composer.json file.

"alexwhitman/view-themes": "1.2.x"

Run composer update to install the latest version.

Setup

This package extends Laravels built in ViewServiceProvider, so that provider must be replaced in app/config/app.php. Replace the instance of 'Illuminate\View\ViewServiceProvider', with 'AlexWhitman\ViewThemes\ViewThemesServiceProvider',.

Configuration

The default settings are for the themes to be in a themes directory in app/ with the default theme called default.

app/
    themes/
        default/
            views/

To change these defaults the package config will need to be published with artisan config:publish alexwhitman/view-themes. The new config file, app/config/packages/alexwhitman/view-themes/config.php, can then be customised as required.

Usage

A standard call to View::make('index') will look for an index view in app/themes/default/views/. However, if a theme is specified with $app['view.finder']->setCurrentTheme('my-theme'); prior to calling View::make() then the view will first be looked for in app/themes/my-theme/views. If the view is not found for the current theme the default theme will then be searched.

Facade

The ViewTheme facade can also be used if preferred ViewTheme::setCurrentTheme('my-theme') by adding an entry for AlexWhitman\ViewThemes\ThemeFacade to app/config/app.php.

Example

Given a directory structure of

app/
    themes/
        default/
            views/
                layout.blade.php
                admin.blade.php
        my-theme/
            views/
                layout.blade.php
View::make('layout'); // Loads app/themes/default/views/layout.blade.php

$app['view.finder']->setCurrentTheme('my-theme');

View::make('layout'); // Loads app/themes/my-theme/views/layout.blade.php
View::make('admin'); // Loads app/themes/default/views/layout.blade.php

Changelog

1.2.0

  • Update for Laravel 4.2

1.1.2

  • Add function to get current theme path

1.1.1

  • Clear previous paths on initialise

1.1.0

  • Update for Laravel 4.1

1.0.0

  • Initial release
You might also like...
Stash view is a composer package for Laravel which caches views using Russian Doll Caching methodology.
Stash view is a composer package for Laravel which caches views using Russian Doll Caching methodology.

Stash View Stash view is a composer package for Laravel which caches views using Russian Doll Caching methodology. What is Russian Doll Caching ? It i

27Laracurl Laravel wrapper package for PHP cURL class that provides OOP interface to cURL. [10/27/2015] View Details

Laracurl Laravel cURL Wrapper for Andreas Lutro's OOP cURL Class Installation To install the package, simply add the following to your Laravel install

A package that adds view-composer like feature to Inertia.js Laravel adapter

Kinetic A package that adds view-composer like feature to Inertia.js Laravel adapter. Use to be able to share props based on the Inertia component nam

This package provides a Filament resource to view all Laravel sent emails.
This package provides a Filament resource to view all Laravel sent emails.

This package provides a Filament resource to view all Laravel outgoing emails. It also provides a Model for the database stored emails. Installation Y

A simple `make:view` command for Laravel applications.

A simple make:view command for Laravel applications. Quickly generate a new Blade view from the console using artisan make:view. Installation You can

Provide all attributes (including irregular patterns) to Laravel Blade class components.

blade-wants-attributes blade-wants-attributes offers you the ability to use Blade/HTML-defined attributes within the constructors of Laravel Blade cla

This package provides extended support for our spatie/enum package in Laravel.
This package provides extended support for our spatie/enum package in Laravel.

Laravel support for spatie/enum This package provides extended support for our spatie/enum package in Laravel. Installation You can install the packag

A package that helps to group methods that mostly use for the view presentation purpose.

A package that helps to group methods that mostly use for the view presentation purpose form models to a dedicated presenter class.

A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.
A package that uses blade templates to control how markdown is converted to HTML inside Laravel, as well as providing support for markdown files to Laravel views.

Install Install via composer. $ composer require olliecodes/laravel-etched-blade Once installed you'll want to publish the config. $ php artisan vendo

Comments
  • Using themes

    Using themes

    I am not understanding from the README how to use the different themes. Am I required to call setCurrentTheme before using any views? Do I need to use setCurrentTheme before each view request?

    This package is exactly what I have been looking for, thank you for your work!

    opened by stramel 7
  • render(); remnants

    render(); remnants

    In rendered views I am seeing this:

    er(); ?>der(); ?> ?>(); ?>render(); ?>

    I assume that is an error within your package as it was not doing this before adding in your package.

    opened by stramel 1
Owner
Alex Whitman
Alex Whitman
Laravel Composable View Composers Package - Compose View Composers from Component Composers

Laravel Virtuoso Laravel Composable View Composers Package Increase flexibility and reduce code duplication by easily composing complex View Composers

Yitzchok Willroth 68 Dec 29, 2021
The University of Arizona Libraries will no longer provide support for Guide on the Side.

The University of Arizona Libraries will no longer provide support for Guide on the Side. The code will remain openly available; however, UAL can no longer provide code fixes or upgrades.

The University of Arizona Libraries 66 Oct 31, 2022
Jetstrap is a lightweight laravel 8 package that focuses on the VIEW side of Jetstream / Breeze package installed in your Laravel application

A Laravel 8 package to easily switch TailwindCSS resources generated by Laravel Jetstream and Breeze to Bootstrap 4.

null 686 Dec 28, 2022
This package provides a Logs page that allows you to view your Laravel log files in a simple UI

A simplistics log viewer for your Filament apps. This package provides a Logs page that allows you to view your Laravel log files in a simple UI. Inst

Ryan Chandler 9 Sep 17, 2022
Helper class for working with Laravel Mix in WordPress themes and plugins.

Hybrid\Mix Hybrid Mix is a class for working with Lavarel Mix. It adds helper methods for quickly grabbing asset files cached in the mix-manifest.json

Theme Hybrid 9 Jun 2, 2022
Laravel components for WordPress plugins and themes

Acorn Acorn adds Laravel components to use in your WordPress plugins and themes. Contributing Contributions are welcome from everyone. We have contrib

Roots 494 Jan 7, 2023
Slim Jam is a demo application to provide examples for composer package, PHPSpreadsheet, Shopify API etc. usages.

SLIM JAM Slim Jam is a demo application to provide examples for composer package, PHPSpreadsheet, Shopify API etc. usages. This project aims to take a

Uğur ARICI 2 Jan 9, 2022
This package extends Illuminate to provide partitioned table creation in migrations.

Laravel Partitions for Migrations This package extends Illuminate to provide partitioned table creation in migrations for PostgreSQL. Support for othe

ORPTech 9 Oct 24, 2022
These are simple array and object collections that provide convinient methods to manipulate them.

Simple Collections These are simple array and object collections that provide convinient methods to manipulate collections; To install this package ty

Artem 4 Nov 19, 2021
This project uses dflydev/dot-access-data to provide simple output filtering for cli applications.

FilterViaDotAccessData This project uses dflydev/dot-access-data to provide simple output filtering for applications built with annotated-command / Ro

Consolidation 44 Jul 19, 2022