PHPackages                             imarc/craft-kindling - 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. imarc/craft-kindling

ActiveCraft-plugin[Templating &amp; Views](/categories/templating)

imarc/craft-kindling
====================

A Craft plugin and Twig Extension providing some convienences.

2.1.2(3y ago)212.7k↓33.3%Apache-2.0PHPPHP ^8.0

Since Apr 28Pushed 3y ago22 watchersCompare

[ Source](https://github.com/imarc/craft-kindling)[ Packagist](https://packagist.org/packages/imarc/craft-kindling)[ Docs](https://github.com/imarc/craft-kindling)[ RSS](/packages/imarc-craft-kindling/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (21)Used By (0)

Kindling
========

[](#kindling)

This is a Craft CMS plugin and Twig extension that provides some convienent logic for use building Craft sites.

This plugin has been updated for Craft 3. For Craft 2, please see the craft2 branch and the latest 1.x release.

Array Extension
---------------

[](#array-extension)

This adds the twig filter `intersect` which simply maps to PHP's own [array\_intersect](http://php.net/manual/en/function.array-intersect.php).

Cookie Extension
----------------

[](#cookie-extension)

This add the twig function `cookie` which can be used to get or a set a cookie. If only one parameter is passed, it returns the value of the cookie if it exists. If more two or more parameters are passed, it has the same parameters as PHP's own [setcookie()](http://php.net/manual/en/function.setcookie.php).

Linkify
-------

[](#linkify)

A simple twig filter, `linkify`, that searches a text string for URLs and email addresses and wraps them in anchor tags. Remember to use the |raw filer on the output.

`{{ linkify(tweet.text)|raw }}`

Inflection Extension
--------------------

[](#inflection-extension)

This add two twig filters: `numberToWords` and `inflect`.

`numberToWords` converts an integer between -999,999,999,999,999,999,999 and 999,999,999,999,999,999,999 into words. It has an optional argument if you'd like the result to be an adjective.

```
{{ 432|numberToWords }} returns "four hundred and thirty-two"
{{ 101|numberToWords(true) }} returns "one hundred and first"

```

`inflect` Takes at least one argument, a formatter expression, that it uses with the quantity. It will try to pluralize the expression automatically, but you can also provide a second argument to specify the exact plural format.

In the formatter expression, you can use `%d`, `%n`, `%a`, or `%%`:

- `%d` is replaced with the original number.
- `%n` is replaced with the original number written out as words.
- `%a` is replaced with the original number written out as an adjective.
- `%%` is a literal %.

```
{{ 1|inflect('cat') }}, {{ 2|inflect('cat') }} returns "cat, cats"
{{ 1|inflect('%n fish') }}, {{ 2|inflect('%d grass') }} returns "one fish, 2 grasses"
{{ 3|inflect('%d person') }} returns "3 people"
{{ 22|inflect('%a day', '%a day') }} returns "twenty-second day"

```

Pathing Variables Extension
---------------------------

[](#pathing-variables-extension)

Path classes provides a way to get classes generated from the current request path. For example,

- URL: ****
    - Using the function: `{{ path_classes() }}` outputs `about company news`
    - Using the variable: `path_classes` returns an array containing `about`, `company`, and `news`

Both of these are designed to be manipulated. The `path_classes` function takes two arguments, `$offset` and `$length`, and uses [array\_slice](http://php.net/manual/en/function.array-slice.php) under the hood:

- URL: ****
    - Using the function: `{{ path_classes(1) }}` outputs `company news big-announcement`
    - Using the function: `{{ path_classes(0, 2) }}` outputs `about company`
    - Using the function: `{{ path_classes(0, -1) }}` outputs `about company news`
    - Using the function: `{{ path_classes(-1) }}` outputs `big-announcement`

Both `$offset` and `$length` can be negative (just like array\_slice). If you would rather get and manipulate an array with Twig, you can use `path_classes`to get back an array, and then use Twig's syntax for array slicing:

- URL: ****
    - Using the variable: `{{ path_classes|join(', ') }}` outputs `about, company, news, big-announcement`
    - Using the variable: `path_classes[:2]` returns an Array containing `about` and `company`

Lastly, there is also `path_id()`. You can use `path_id` as a variable or a function:

- URL: ****
    - Using the variable: `{{ path_id }}` outputs `about-company-news-big-announcement`
    - Using the function: `{{ path_id(0, 3) }}` outputs `about-company`
    - Using the function: `{{ path_id(0, -1) }}` outputs `about-company-news`

*But what about the homepage?* Try the `?:` operator.

Putting it all together:

```

    ...

```

Lastly, if you store whatever you're going to use for the body ID to a variable, this is probably easier to work with than `craft.request.path` to check whether you're on that page (to say, hide/show parts of a twig layout.)

Wrap Embeds Extension
---------------------

[](#wrap-embeds-extension)

This is a simple twig filter, `wrapembeds`, that searches for `` tags in the text passed in, and if it finds any, wraps them in a div with a class of "responsive\_video".

Template Variables
------------------

[](#template-variables)

executionTime Outputs the time required for the server to execute the page output

`{{ craft.kindling.executionTime }}`

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 58.1% 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 ~148 days

Recently: every ~185 days

Total

16

Last Release

1440d ago

Major Versions

1.2.2 → 2.0.02018-04-17

1.2.3 → 2.0.12018-04-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/00725533df5fd021ac93639028725bf46bef78f6d924618a987b9bfd5c32c3eb?d=identicon)[jeffturcotte](/maintainers/jeffturcotte)

![](https://www.gravatar.com/avatar/4c423d4aa457201693aadc0ffd67895f3383709e89c66547949d65a37123ee22?d=identicon)[khamer](/maintainers/khamer)

---

Top Contributors

[![khamer](https://avatars.githubusercontent.com/u/1452?v=4)](https://github.com/khamer "khamer (25 commits)")[![BillBushee](https://avatars.githubusercontent.com/u/366423?v=4)](https://github.com/BillBushee "BillBushee (10 commits)")[![cherrykoda](https://avatars.githubusercontent.com/u/3789834?v=4)](https://github.com/cherrykoda "cherrykoda (3 commits)")[![jeffturcotte](https://avatars.githubusercontent.com/u/65089?v=4)](https://github.com/jeffturcotte "jeffturcotte (3 commits)")[![brandonkelly](https://avatars.githubusercontent.com/u/47792?v=4)](https://github.com/brandonkelly "brandonkelly (1 commits)")[![VadimBeliak](https://avatars.githubusercontent.com/u/24794702?v=4)](https://github.com/VadimBeliak "VadimBeliak (1 commits)")

---

Tags

cmsCraftcraftcmscraft-plugincraft-kindling

### Embed Badge

![Health badge](/badges/imarc-craft-kindling/health.svg)

```
[![Health](https://phpackages.com/badges/imarc-craft-kindling/health.svg)](https://phpackages.com/packages/imarc-craft-kindling)
```

###  Alternatives

[lewisjenkins/craft-dynamic-fields

Populate Craft fields with dynamic data using the power of Twig.

14667.0k](/packages/lewisjenkins-craft-dynamic-fields)[nystudio107/craft-minify

A simple plugin that allows you to minify blocks of HTML, CSS, and JS inline in Craft CMS templates.

37461.2k28](/packages/nystudio107-craft-minify)[jalendport/craft-preparse

A fieldtype that parses Twig when an element is saved and saves the result as plain text.

1086.4k](/packages/jalendport-craft-preparse)[craftpulse/craft-colour-swatches

Let clients choose from a predefined set of colours and utilise associated colour codes and class names in your templates.

3530.8k2](/packages/craftpulse-craft-colour-swatches)[superbig/craft-mjml

Render Twig emails with MJML, the only framework that makes responsive email easy.

2627.3k1](/packages/superbig-craft-mjml)[verbb/footnotes

Adds a footnotes feature to CKEditor fields and Twig templates.

213.3k](/packages/verbb-footnotes)

PHPackages © 2026

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