PHPackages                             kylekatarnls/jade-filter-base - 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. kylekatarnls/jade-filter-base

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

kylekatarnls/jade-filter-base
=============================

Example for Pug-php filter, use this base to create and publish your own

1.2.0(9y ago)020MITPHP

Since Mar 16Pushed 6y ago1 watchersCompare

[ Source](https://github.com/kylekatarnls/jade-filter-base)[ Packagist](https://packagist.org/packages/kylekatarnls/jade-filter-base)[ RSS](/packages/kylekatarnls-jade-filter-base/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

This repository now lives on

pug-filter-base
===============

[](#pug-filter-base)

Example for Pug-php filter, use this base to create and publish your own

How to create and publish your own filter
-----------------------------------------

[](#how-to-create-and-publish-your-own-filter)

Install composer:

Then create a project based on this package:

```
composer create-project pug-php/pug-filter-base yourfilter
cd yourfilter
```

Replace **yourfilter** with the directory name you wish, composer will create it and install pug-filter-base inside.

If your filter require somes other packages to work, add them with composer, for example:

```
composer require kylekatarnls/sbp
```

NB: By default, the composer.json file is set to "minimum-stability": "stable", but some packages have no stable version. To install them, set it to dev:

```
"minimum-stability": "dev",
```

```
composer require neemzy/stylus
```

Then rename **src/Pug/Filter/Base.php** to **src/Pug/Filter/YourFilter.php**For example, to create a filter you will call with `:foo`, call the file Foo.php, `:foo-bar-baz`, FooBarBaz.php and so on.

Then give the class inside this file the same name, and edit the **\_\_invoke**method, you get the filter node of the Pug structure tree and the Pug compiler and you can treat each line to iterate on $node-&gt;block-&gt;nodes or get all the text with `$this->getNodeString($node, $compiler)`Here begin the fun part, execute any action as you want then return a string that will be rendered in the HTML.

Test your filter
----------------

[](#test-your-filter)

Please do not publish a filter with no test. Give us one or more examples in the directory **examples** to see how to use your filter by creating a file with .pug extension then create another file with the same name but .html extension to show the result. (Replace or remove the basic example.)

You can now check that everyting work as expected with phpunit, execute at your project root:

```
./vendor/bin/phpunit
```

If your filter render all your examples as expected, you get 100% and OK, else you will see the difference between the expected result and the rendered pug for each broken example.

Configure it
------------

[](#configure-it)

To publish your filter, you will need an account on If you haven't already, create one. The username you choose will appear as the filter author on .

Now you can set the name of your package in **composer.json**. It must follow this syntax: `username/pug-filter-filtername`or `username/pug-php-filter-filtername` (jade, the old name of pug is also accepted instead of pug) with username your packagist username and filtername the filter name as it will be called in the pug template, so if you sign up as *dark-vador* on  and create a package you will call with `:foo-bar-baz` in your template, your **composer.json** should contains:

```
{
    "name": "dark-vador/pug-filter-foo-bar-baz",
    ...
}
```

Then explain what your filter do in the description field.

Document it
-----------

[](#document-it)

Replace the project **README.md** with informations about how to install, for example:

```
composer require pug-php/pug-filter-sbp
```

Publish it
----------

[](#publish-it)

Now you can host your filter on any Git, Svn or Hg server.

We encourage you to use  as is optimized for it and you can follow this instructions:

You can add Packagist as a service in GitHub with Settings &gt; Webhooks &amp; services &gt; Add service &gt; Packagist, enter your username and your token and each time you will draft a release in GitHub or push a tag, it will publish a version on Packagist and on . It can take one minute or two.

Last step, go to  and enter the URL of your repository.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~44 days

Total

4

Last Release

3575d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/df90c422f521bf26355c3e185a59fe7afb35531af56244dfaec03ee1d0ca6f24?d=identicon)[kylekatarn](/maintainers/kylekatarn)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kylekatarnls-jade-filter-base/health.svg)

```
[![Health](https://phpackages.com/badges/kylekatarnls-jade-filter-base/health.svg)](https://phpackages.com/packages/kylekatarnls-jade-filter-base)
```

###  Alternatives

[bkwld/laravel-pug

Pug view adapter for Laravel

15967.4k2](/packages/bkwld-laravel-pug)[nystudio107/craft-twigpack

Twigpack is a bridge between Twig and webpack, with manifest.json &amp; webpack-dev-server HMR support

97341.4k17](/packages/nystudio107-craft-twigpack)[pug-php/pug-symfony

Pug template engine for Symfony

444.4k](/packages/pug-php-pug-symfony)[ci-pug/ci-pug

HAML-like template engine for CodeIgniter

211.7k](/packages/ci-pug-ci-pug)

PHPackages © 2026

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