PHPackages                             timknight/craft-macro-kit - 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. timknight/craft-macro-kit

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

timknight/craft-macro-kit
=========================

A collection of Twig macros for Craft CMS

1.2.0(7y ago)15416MITHTML

Since Jan 28Pushed 7y agoCompare

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

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

Macro Kit for Craft CMS
=======================

[](#macro-kit-for-craft-cms)

Macro Kit provides several functions that can be imported into your front-end templates for use in Craft CMS.

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0.0 or later.

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

[](#installation)

To install Macro Kit, follow these steps:

1. Install with Composer using `composer require timknight/craft-macro-kit`
2. Install the plugin in the Craft Control Panel under `Settings > Plugins`

Macro Kit is also available in the Craft Plugin Store available in the Control Panel.

Usage
-----

[](#usage)

Macro Kit can be used within your templates simply by importing all of the macros into a template.

```
{% import "_macrokit/all" as mk %}

```

Or import individual macros into the current namespace.

```
{% from "_macrokit/all" import dateRange, randomString %}
{{ dateRange(event.start, event.end) }}
{{ randomString(10) }}

```

You can customize the path to the `all.twig` template (`_macrokit` by default) by editing the plugin’s “Template Path” setting, or creating a `config/macro-kit.php` file with this:

```
