Download the PHP package bagosii/laravel-theme without Composer

On this page you can find all versions of the php package bagosii/laravel-theme. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-theme

Description

Laravel License Downloads

This is a package for the Laravel 5 Framework that adds basic support for managing themes. It allows you to seperate your views & your assets files in seperate folders, and supports for theme extending! Awesome :)

Features:

How it works

Very simple, you create a folder for each Theme in 'resources/views' and keep all your views seperated. The same goes for assets: create a folder for each theme in your 'public' directory. Set your active theme and you are done. The rest of your application remains theme-agnostic©, which means that when you View::make('index') you will access the index.blade.php from your selected theme's folder. Same goes for your assets.

Installation

Edit your project's composer.json file to require:

"require": {
    "bagosii/laravel-theme": "~1.0"
}

and install with composer update

Add the service provider in app/config/app.php, Providers array:

'bagosii\laravelTheme\themeServiceProvider',

also edit the Facades array and add:

'Theme'  => 'bagosii\laravelTheme\Facades\Theme',

Almost Done. You only need to publish configuration file to your application with

artisan vendor:publish

That's it. You are now ready to start theming your applications!

Defining themes

Simple define your themes in the themes array in config\theme.php. The format for every theme is very simple:

all settings are optional and can be ommited. Check the example in the configuration file... If you are OK with the defaults then you don't even have to touch the configuration file. If a theme is not found then the default values will be used (Convention over configuration)

Extending themes

You can set a theme to extend an other. When you are requesting a view/asset that doesn't exist in your active theme, then it will be resolved from it's parent theme. You can easily create variations of your theme by simply overiding your views/themes that are different.

All themes fall back to the default laravel folders if a resource is not found on the theme folders. So for example you can leave your common libraries (jquery/bootstrap ...) in your public folder and use them from all themes. No need to dublicate common assets for each theme!

Working with Themes

The default theme can be configured in the theme.php configuration file. Working with themes is very straightforward. Use:

For example this is a Service Provider that will select a different theme for the /admin/xxx urls:

...or you can use a middleware to apply a theme to a Route::group() etc. For more advanced example check demo application: Set Theme in Session

Building your views

Whenever you need to link to a local file (image/css/js etc) you can retreive its path with:

The path is relative to Theme Folder (NOT to pubic!). For example, if you have placed an image in public\theme-name\img\logo.png your Blade code would be:

<img src="{{Theme::url('img\logo.png')}}">

When you are refering to a local file it will be looked-up in the current theme hierarcy, and the correct path will be returned. If the file is not found on the current theme or its parents then an exception will be thrown.

Some usefull helpers you can use:

Assets Managment (Optional)

This package provides intergration with Orchestra/Asset component. All the features are explained in the official documentation. Although Orchestra/Asset is installed along with this package, it's use is optional.

To use the Orchestra\Asset you need to add in your Providers array:

'Orchestra\Asset\AssetServiceProvider',
'Orchestra\Html\HtmlServiceProvider',

and add the Asset facade in your Facades array in app/config/app.php

'Asset' => 'Orchestra\Support\Facades\Asset',

Now you can leverage all the power of Orchestra\Asset package. However the syntax can become quite cumbersome when you are using Themes + Orchestra/Asset, so some Blade-specific sugar has been added to ease your work. Here how to build your views:

In any blade file when you need to refer to a script or css: (dont use single/double quotes)

@css(filename)
@js(filename)

Please note that you are just defining your css/js files but not actually dumping them in html. Usually you only need write your css/js decleration in one place on the Head/Footer of you page. So open your master layout and place:

{!! Asset::styles() !!}
{!! Asset::scripts() !!}

exactly where you want write your declerations.

Assets dependencies

This is an Orchestra/Asset feature explained well in the official documentation. Long story short:

@css (filename, alias, depends-on)
@js  (filename, alias, depends-on)

and your assets dependencies will be auto resolved. Your assets will be exported in the correct order. The biggest benefit of this approach is that you don't have to move all your declerations in your master layout file. Each sub-view can define it's requirements and they will auto-resolved in the correct order with no doublications. Awesome! A short example:

@js  (jquery.js,    jq)
@js  (bootstrap.js, bs, jq)

Important Note:

Laravel is compiling your views every-time you make an edit. A compiled view will not recompile unless you make any edit to your view. Keep this in mind while you are developing themes...


All versions of laravel-theme with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 5.0.*
orchestra/asset Version ~3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bagosii/laravel-theme contains the following files

Loading the files please wait ....