PHPackages                             chipotle/slimx - 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. [Templating &amp; Views](/categories/templating)
4. /
5. chipotle/slimx

AbandonedArchivedLibrary[Templating &amp; Views](/categories/templating)

chipotle/slimx
==============

Lightweight templating and PDO data access for Slim

1.0.0-rc1(12y ago)61.6k3MITPHPPHP &gt;=5.3.0

Since Mar 24Pushed 4y agoCompare

[ Source](https://github.com/chipotle/Slimx)[ Packagist](https://packagist.org/packages/chipotle/slimx)[ RSS](/packages/chipotle-slimx/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

SlimX - Extensions for Slim
===========================

[](#slimx---extensions-for-slim)

**Note that SlimX is no longer developed or supported, and probably isn't useful with current versions of Slim.** You're welcome to try to adapt it for your own purposes, though, consistent with the MIT license.

This is a *very* small set of extensions for the [Slim Framework](http://www.slimframework.com), a Sinatra-like "microframework" for PHP.

A couple years ago I started my own PHP microframework, Flagpole; it became usable, but never really advanced much, and I shelved it when it became clear there were other better projects of a similar nature like Slim.

Actually starting a project in Slim, though, showed me two things that I missed from Flagpole: a lightweight database access wrapper and a "native PHP" templating system that at *least* supported the concept of layouts like early Rails apps did. It appears a lot of people using Slim are using [Twig](http://twig.sensiolabs.org) for templating; I think Twig is a terrific template system, but sometimes you don't need that level of abstraction, or you're working with co-workers who only know pure PHP. And often you don't need an ORM, but you'd still like to have some convenience wrappers for database access.

Installation
------------

[](#installation)

The best way to install SlimX is through Composer. In your `composer.json` file:

```
{
	"require": {
		"slim/slim": "2.*",
		"chipotle/slimx": "dev-master"
	}
}

```

If you're doing manual installation, SlimX follows the [PSR-0 standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md).

\\Slimx\\View
-------------

[](#slimxview)

This class extends `\Slim\View` to have two extra concepts: *layouts* and *the base tag.*

### Usage

[](#usage)

Simply instantiate the Slim application object with Slimx set as a custom view provider. The API is the same as Slim's native view.

```
$app = new \Slim\Slim([
	'view' => new \Slimx\View();
]);

```

### Layouts

[](#layouts)

This is a simple version of template inheritance. A template's layout is just a "frame" in which the content is placed, appropriately enough in the variable `$content`. A layout might look like this:

```

  Site
