PHPackages                             habanero/neddle - 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. habanero/neddle

AbandonedArchivedLibrary

habanero/neddle
===============

The most simple templating engine for PHP

v0.3.1(13y ago)1160PHPPHP &gt;=5.3

Since Apr 26Pushed 13y ago2 watchersCompare

[ Source](https://github.com/hbnro/neddle)[ Packagist](https://packagist.org/packages/habanero/neddle)[ RSS](/packages/habanero-neddle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Tailor's skills!
================

[](#tailors-skills)

Neddle is inspired from HAML/Jade and CoffeeScript, isn’t really a full parser but it handles your templates very well.

Ok, it might have issues and do not throw any warnings about syntax errors.

The basics
----------

[](#the-basics)

Like other haml-like templating engines, it uses white space to nest your blocks. Also has minimal support for inline expressions, closures and almost all php code.

**inline-comments**

```
/ html
- # php
; invisible

```

**block-comments**

```
/
  large and
  nested html comments

```

**html-blocks**

```
#id.class { attr => $value }
  a { href => '#' } link text

p
  nested text
  here

pre
  |and the pipe
  |    preserves the white-space
  | in the block

      also you can use raw html

\a string value (not parsed)
a string value (parsed)

:some-filter
  any block of text (not parsed)

```

**php-blocks**

```
- if $condition
  = 'success'

ul
  - for $i = 0; $i < 10; $i += 1
    li = "Item $i"

- $all = array(1, 2, 3)
p #{$one} @while $one = array_shift($all)

- unless false
  some text

- print_r(call_user_func(~>
  - return range(0, 10)

- $lambda = ($value) ~>
  - return $value

= $lambda('some value')
~ $lambda('escaped text')

```

As you can see the syntax is very simple and compatible with php. ;-)

Usage
-----

[](#usage)

Append it to your composer.json, then run `$ php composer.phar install`to get the latest version.

```
{
  "require": {
    "habanero/tailor": "dev-master"
  }
}

```

Remember that neddle will not handle your views, it only pre-compile your templates into php code. You should save and execute the produced code.

```
