PHPackages                             geedmo/jade.php - 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. geedmo/jade.php

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

geedmo/jade.php
===============

PHP template system based on JADE template syntax.

3251PHP

Since Dec 19Pushed 12y agoCompare

[ Source](https://github.com/geedmo/jade.php)[ Packagist](https://packagist.org/packages/geedmo/jade.php)[ RSS](/packages/geedmo-jadephp/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Jade.php
========

[](#jadephp)

Jade.php adds inline PHP scripting support to the [Jade](http://jade-lang.com) template compiler.

Fork Details
------------

[](#fork-details)

Due to the existence of several fork of the [original project](https://github.com/everzet/jade.php), the intent of this fork is only to keep track of the changes, add new fixes when necessary and shared the source via a personal composer account.
Issues are welcome.

Notes
-----

[](#notes)

Please check the git commit history for the authoritative list of contributors **[HERE](https://github.com/everzet/jade.php/network)**.

Syntax (wip)
------------

[](#syntax-wip)

### **[Official Jade Syntax](https://github.com/visionmedia/jade#readme)**

[](#official-jade-syntax)

### Line Endings

[](#line-endings)

**CRLF** and **CR** are converted to **LF** before parsing.

### Indentation

[](#indentation)

Jade is indentation based, however currently only supports a *2 space* indent.

### Tags

[](#tags)

A tag is simply a leading word:

```
html

```

for example is converted to ``

tags can also have ids:

```
div#container

```

which would render ``

how about some classes?

```
div.user-details

```

renders ``

multiple classes? *and* an id? sure:

```
div#foo.bar.baz

```

renders ``

div div div sure is annoying, how about:

```
#foo
.bar

```

which is syntactic sugar for what we have already been doing, and outputs:

```

```

jade.php has a feature, called "autotags". It's just snippets for tags. Autotags will expand to basic tags with custom attributes. For example:

```
input:text

```

will expand to `` &amp; it's the same as `input( type="text" )`, but shorter. Another examples:

```
input:submit( value="Send" )

```

will become ``.

You can even add you own autotags with:

```
$parser->setAutotag('input:progress', 'input', array('type'=>'text', class=>'progress-bar'));

```

that will expands to ``.

It also supports new HTML5 tags (`input:email` =&gt; ``).

### Tag Text

[](#tag-text)

Simply place some content after the tag:

```
p wahoo!

```

renders `wahoo!`.

well cool, but how about large bodies of text:

```
p
  | foo bar baz
  | rawr rawr
  | super cool
  | go Jade go

```

renders `foo bar baz rawr.....`

Actually want `` for some reason? Use `{{}}` instead:

```
p {{$something}}

```

now we have ``

### Nesting

[](#nesting)

```
ul
  li one
  li two
  li three

```

### Attributes

[](#attributes)

Jade currently supports '(' and ')' as attribute delimiters.

```
a(href='/login', title='View login page') Login

```

Alternatively we may use the colon to separate pairs:

```
a(href: '/login', title: 'View login page') Login

```

Boolean attributes are also supported:

```
input(type="checkbox", checked)

```

Boolean attributes with code will only output the attribute when `true`:

```
input(type="checkbox", checked: someValue)

```

Note: Leading / trailing whitespace is *ignore* for attr pairs.

### Doctypes

[](#doctypes)

To add a doctype simply use `!!!` followed by an optional value:

```
!!!

```

Will output the *transitional* doctype, however:

```
!!! 5

```

Will output html 5's doctype. Below are the doctypes defined by default, which can easily be extended:

```
$doctypes = array(
       '5' => '',
       'xml' => '',
       'default' => '',
       'transitional' => '',
       'strict' => '',
       'frameset' => '',
       '1.1' => '',
       'basic' => '',
       'mobile' => ''
   );

```

Comments
--------

[](#comments)

### Jade Comments

[](#jade-comments)

Jade supports sharp comments (`//- COMMENT`). So jade block:

```
//- JADE
- $foo = "";
p
//- ##### COMMENTS ARE SUPPER! ######
  - switch ($foo)
    -case 2
      p.foo= $foo
//-    - case 'strong'
  //-      strong#name= $foo * 2
    -   case 5
      p some text

```

will be compiled into:

```

      some text

```

### HTML Comments

[](#html-comments)

Jade supports HTML comments (`// comment`). So block:

```
peanutbutterjelly
  // This is the peanutbutterjelly element
  | I like sandwiches!

```

will become:

```

  I like sandwiches!

```

As with multiline comments:

```
//
  p This doesn't render...
  div
    h1 Because it's commented out!

```

that compile to:

```

```

### IE Conditional Comments

[](#ie-conditional-comments)

Also, Jade supports IE conditional comments, so:

```
// [if IE]
  a( href = 'http://www.mozilla.com/en-US/firefox/' )
    h1 Get Firefox

```

will be parsed to:

```

```

Filters
-------

[](#filters)

Filters are prefixed with `:`, for example `:javascript` or `:cdata` and pass the following block of text to an arbitrary function for processing. View the *features*at the top of this document for available filters.

```
body
  :php
    | $data = 40;
    | $data /= 2;
    | echo $data;

```

Renders:

```

```

Code
----

[](#code)

### Buffered / Non-buffered output

[](#buffered--non-buffered-output)

Jade currently supports two classifications of executable code. The first is prefixed by `-`, and is not buffered:

```
- var $foo = 'bar';

```

This can be used for conditionals, or iteration:

```
- foreach ($items as $item):
  p= $item

```

Due to Jade's buffering techniques the following is valid as well:

```
- if ($foo):
  ul
    li yay
    li foo
    li worked
- else:
  p hey! didnt work

```

Second is echoed code, which is used to echo a return value, which is prefixed by `=`:

```
- $foo = 'bar'
= $foo
h1= $foo

```

Which outputs

```

```

### Code blocks

[](#code-blocks)

Also, Jade has Code Blocks, that supports basic PHP template syntax:

```
ul
  - while (true):
    li item

```

Will be rendered to:

```

    item

```

But don't forget about colons `:` after instructions start (`- if(true) :`).

There's bunch of default ones: `if`, `else`, `elseif`, `while`, `for`, `foreach`, `switch`, `case`.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c6d4d6bbe3007311ea5370bfae1bb94706079383e1247b64a1d2297dd42ddee?d=identicon)[geedmo](/maintainers/geedmo)

---

Top Contributors

[![geedmo](https://avatars.githubusercontent.com/u/3003670?v=4)](https://github.com/geedmo "geedmo (3 commits)")

### Embed Badge

![Health badge](/badges/geedmo-jadephp/health.svg)

```
[![Health](https://phpackages.com/badges/geedmo-jadephp/health.svg)](https://phpackages.com/packages/geedmo-jadephp)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

545.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
