PHPackages                             roggeo/glance - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. roggeo/glance

ActiveLibrary

roggeo/glance
=============

Glance - Theme manager of sites PHP

118PHP

Since Mar 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/roggeo/glance)[ Packagist](https://packagist.org/packages/roggeo/glance)[ RSS](/packages/roggeo-glance/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

\#Glance

\###Themes manager for APPs in PHP

\##Why use?

With a manager of themes you can separate your styles (as CSS, JS, images among others) in your web application, without worrying many about changes in the URIs in your template file (as .tpl, .html, .phtml among others).

For example, to get files of style, you use only:

```
$theme->css("custom.css");

```

or all CSSs.

```
$theme->css();

```

[See several examples](#methods) or [see one Demo](https://github.com/roggeo/demo-glance)

\##Install

- 1. Run the commands:

```
$ mkdir your_project
$ cd your_project
$ php -r "readfile('https://getcomposer.org/installer');" | php
```

- 2. Create a file **your\_project/composer.json** with the following content:

```
{
    "require": {
        "roggeo/glance": "dev-master"
    }
}
```

- 3. Run the commands:

```
$ php composer.phar update
```

Or simply (if you have installed Composer) run the following commands in your application folder:

```
$ mkdir your_project
$ cd your_project
$ composer require roggeo/glance:dev-master
```

\##How use?

- 1. Create a file **your-folder-themes/config.yml**:

```
# Name of the themes, if enabled tell true
themes:
    "sometheme1":
    "sometheme2":
    "sometheme3": true
    "sometheme4":
```

- 2. Create a file **your-folder-themes/your-theme/theme.yml**:

```
#Information of a specific theme
theme  : Litht
author : Geovani
email  : name@email.com
date   : 2015-11-08
license: http://opensource.org/licenses/MIT
link   : https://yoursite.com
description: >
    Theme default for Glance
```

- 3. Your repository themes should have a basic structure, such as: **theme** (folder to save all themes), **light** and **dark** are theme sample. Files in folder **light** are the basic structure of a theme for Glance. See a image:

[![Glance Explorer](docs/img/explorer.png)](#)

- 4. Create a file **public/theme/index.php**, and insert the code:

```
require_once __DIR__.'/../../vendor/autoload.php';
use Glance\Response;
Response::listenMessage();
```

- 5. Create a file **public/theme/.htaccess**, and insert the code:

```

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?get=$1 [L]

```

\##Instructions for themes Glance

[Theme](https://github.com/roggeo/light), see example of one.

[Demo](https://github.com/roggeo/demo-glance), see how to use.

\##Methods

```
...
//code configuration
...

//images
$theme->img("name-image", "png");
$theme->img(array("image-1","image-2"), "png");
$theme->img("name-image.jpg");

//css
$theme->css("custon.css");
$theme->css(array("custon", "main"));
$theme->css(array("custon.css", "main"));
$theme->css();

//javascript
$theme->js("custon.js");
$theme->js(array("custon", "main"));
$theme->js(array("custon.js", "main"));
$theme->js();

//Call files of another Theme
$theme->css('side','dark');
$theme->js('home', 'dark');
$theme->img('book','png','dark');
$theme->enqueue('img/book.png','dark');

//All
$theme->enqueue('image.png');
$theme->assets('style.css','bootstrap');
```

\##In your web page

Create a index.php at the root of your project with the following content:

```
