PHPackages                             thepixelage/craft-fragments - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. thepixelage/craft-fragments

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

thepixelage/craft-fragments
===========================

Fragments is a Craft CMS plugin for managing content and presentational fragments

5.0.3(9mo ago)65.6k↑83.3%2[3 issues](https://github.com/thepixelage/craft-fragments/issues)proprietaryPHPPHP ^8.2

Since Aug 11Pushed 9mo ago2 watchersCompare

[ Source](https://github.com/thepixelage/craft-fragments)[ Packagist](https://packagist.org/packages/thepixelage/craft-fragments)[ RSS](/packages/thepixelage-craft-fragments/feed)WikiDiscussions develop-v4 Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (41)Used By (0)

[![Fragments icon](https://camo.githubusercontent.com/7c988ad7bba946c6544cf1aa8a8ee3973821b32c9661a54d4b49a13f1fa421de/68747470733a2f2f7777772e746865706978656c6167652e636f6d2f706c7567696e732f6173736574732f69636f6e2d667261676d656e74732e737667)](https://www.thepixelage.com/plugins/fragments)

Fragments Plugin for Craft CMS
==============================

[](#fragments-plugin-for-craft-cms)

**[Fragments](https://www.thepixelage.com/plugins/fragments)** is a Craft CMS plugin for managing content and presentational fragments. It allows you to decouple your entry types from content blocks, widgets or components that are ad-hoc or presentational in nature, similar to blocks and regions in Drupal or modules and positions in Joomla.

Fragments
---------

[](#fragments)

With **Fragments** comes a set of entities to help you manage content and presentational fragments:

- **Fragment types**
    Just like entry types, you can set up the content model and field layout for your fragments.
- **Zones**
    Template zones, or simply zones, are areas in your templates in which fragments will be created and displayed. Zones can be limited to allow only specific fragment types.
- **Fragments (element)**
    These are the actual content blocks to be displayed. Each fragment can be further customised to be included or excluded in the zones depending on visibility rules.
- **Fragments (custom field)**
    The included Fragments field allows your content editors to relate to Fragments in some or all of the zones. This opens up possibility to create reuseable fragments that can be included in entries and content block builders.

Why Fragments?
--------------

[](#why-fragments)

There are many situations where fragments of content need to be displayed in multiple pages, but they are ad-hoc content parts or data that may not be part of your entry types.

For example, your Services pages may need a call-to-action button or lead form specific to the service. While you may model a custom field in the Services entry type to allow content editors to indicate the call-to-action to display, this piece of information becomes coupled to the entry type. If these buttons and lead forms also need to appear on other pages, each of the other entry types also need to have this field added to them.

Without **Fragments**, you may use features in Craft CMS to cobble together a solution around this, but they bring along some challenges:

- **Sections and entry types**
    Entry types are good for mapping domain models to content models, but for content parts that have no direct relations to these domain models, it may become awkward to represent them as part of the content models, or an overkill to create whole sections just to represent them.
- **Globals**
    Globals are usually used for content that do not belong as entries or are needed across different pages. However, in multi-site setups, using globals becomes difficult for managing different content on different sites, since all global sets are visible in the control panel for all the sites. This can create confusion for your content editors.
- **Content Blocks/Content Builder (Matrix/Neo)**
    Content block builder fields can become cluttered with too many block types. **Fragments** can be used as a subsystem with its own types and zones (think of them as groups or collections) that makes your content block builder fields more scalable.

With **Fragments**, your content editors can create call-to-action fragments that can be included in template zones outside of the entry types.

Documentation
-------------

[](#documentation)

Learn more and read the documentation at .

License
-------

[](#license)

This plugin requires a commercial license purchasable through the [Craft Plugin Store](https://plugins.craftcms.com/fragments).

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

[](#requirements)

This plugin requires Craft CMS 3.6.0 or later.

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

[](#installation)

You can install this plugin from the Plugin Store or with Composer.

### From the Plugin Store

[](#from-the-plugin-store)

Go to the Plugin Store in your project’s Control Panel and search for “Fragments”. Then click on the “Install” button in its modal window.

### With Composer

[](#with-composer)

Open your terminal and run the following commands in your project directory:

```
# tell Composer to load the plugin
composer require thepixelage/craft-fragments

# tell Craft to install the plugin
./craft install/plugin fragments

```

Setup
-----

[](#setup)

Before you can start creating fragments, you need to set up the fragment types and template zones. The **Fragments** section will only appear after at least one fragment type and one template zone are created.

### Fragment Types

[](#fragment-types)

Fragment types are similar to how entry types are set up. Custom fields can be specified to give a structured content model for the fragments.

To create a new fragment type, go to **Settings → Fragments → Fragment Types**.

### Zones

[](#zones)

Template zones (or zones, as we simply call it) allow you to specify areas in your templates where fragments can be created and displayed in. Zones can also limit the fragment types that are allowed to be created in them. This helps make it easier to organise and manage fragments in the zones.

To create a new template zone, go to **Settings → Fragments → Zones**.

Querying Fragments
------------------

[](#querying-fragments)

To query a list of fragments in a zone to display in your templates:

```
{% set fragments = craft.fragments.zone('myZoneHandle').all() %}

```

Once you have queried the list of fragments, you can access the fields the same way you do for Entries.

```
{% for fragment in fragments %}
    {{ fragment.textField }}

{% endfor %}

```

To target only fragments of a certain fragment type, modify the previous query like this:

```
{% set fragments = craft.fragments.zone('myZoneHandle').type('myFragmentTypeHandle').all() %}

```

GraphQL Support
---------------

[](#graphql-support)

GraphQL is supported from version 1.1.0. An example query is shown below:

```
{
    fragments(zone: "myZone", type: "myType", currentUrl: "/my-page") {
        __typename
        uid
        title
        ... on myFragmentType_Fragment {
            textField
        }
        ... on anotherFragmentType_Fragment {
            imageField
        }
    }
}
```

The arguments `zone` and `type` work the same way as the Twig example above.

Use `currentUrl` to pass in a URL that can be used to match against any fragment visibility rules that you have set up.

---

Created by [ThePixelAge](https://www.thepixelage.com)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance48

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity75

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 ~52 days

Recently: every ~130 days

Total

29

Last Release

270d ago

Major Versions

1.1.2 → 4.0.0-beta.12022-03-19

1.1.3 → 4.0.0-beta.52022-04-17

1.1.4 → 4.0.12023-01-19

4.0.3 → 5.0.0-beta.12024-03-11

PHP version history (2 changes)4.0.0-beta.1PHP ^8.0

5.0.0-beta.1PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/5db44c3e43bacce630bcc602e8043bba6e3cf676d275e7f92b3069458b0dc22c?d=identicon)[MrRonbot](/maintainers/MrRonbot)

---

Top Contributors

[![MrRonbot](https://avatars.githubusercontent.com/u/1901227?v=4)](https://github.com/MrRonbot "MrRonbot (115 commits)")

---

Tags

craft-plugincraft3craftcmscmsCraftcraftcmscraft-plugincraft-fragments

### Embed Badge

![Health badge](/badges/thepixelage-craft-fragments/health.svg)

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

###  Alternatives

[verbb/navigation

Create navigation menus for your site.

90683.7k17](/packages/verbb-navigation)[verbb/formie

The most user-friendly forms plugin for Craft.

101372.9k40](/packages/verbb-formie)[verbb/comments

Add comments to your site.

13753.1k](/packages/verbb-comments)[verbb/tablemaker

Create customizable and user-defined table fields.

40168.8k1](/packages/verbb-tablemaker)[supercool/tablemaker

Create customizable and user-defined table fields.

40141.7k](/packages/supercool-tablemaker)[pennebaker/craft-architect

CraftCMS plugin to generate content models from JSON/YAML data.

72148.5k5](/packages/pennebaker-craft-architect)

PHPackages © 2026

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