Download the PHP package seanmorris/theme without Composer

On this page you can find all versions of the php package seanmorris/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 theme

SeanMorris\Theme

Simple, sane templating and theming for PHP

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

The aim of the Theme library is to provide a start separation of presentation from logic. It has only two responsibilities:

Composer

Just run composer require seanmorris/theme in your project directory.

You can also add "seanmorris/theme": "^1.0.0" to the require array in your project's composer.json.

Templating

Coupling the template with the View class is very simple. Simply subclass the provided View and append the template after a call to __halt_compiler(); (WITH THE CLOSING ?>) like so:

(note: Short tags are enabled for simple echo statements as of PHP 5.4, but are not required)

Pass an associative array into the constructor to populate the variables in the template. The keys of the array will be translated to variable names.

Preprocessing

Preprocessing templates is simple. Just implement the method in your view class, and you'll get a chance to operate on the variables prior to rendering.

Usage:

Theming

Creating a theme is as simple as extending the theme class and providing a mapping from your object classes to their view classes, as shown:

Usage:

Wrapping

If you've got a default "trim" you'd like to use to wrap everything (i.e. the view that contains your , and structure), simply set the static property $wrap to an array listing your wrappers, innermost to outtermost.

Usage:

Advanced Stuff...

Although the library doesn't do much, its got some power under the hood.

Fallback Themes

If a theme cannot render an object, it can defer the rendering to other themes that can. This is done by specifying the $themes static property. The list will be check in order, until a theme is able to render a given object.

Subclassing Views

You can subclass any view class and keep the template by ommitting the call to __halt_compiler(), and extending the existing view. You'll probably want to override the parent preprocessor as well.

Contextualized Themeing

By defining mappings from classes to views in the $contextViews array, you can specify that a view should be rendered differently when the render call is made from certain classes.

In this example SeanMorris\Stuff\Foo will be rendered with the SeanMorris\Theme\FooAlternateView class when rendered inside of the SeanMorris\Stuff\RandomObject class, but outside, it will be rendered with SeanMorris\Theme\FooView.


All versions of theme with dependencies

PHP Build Version
Package Version
No informations.
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 seanmorris/theme contains the following files

Loading the files please wait ....