PHPackages                             bnomei/kirby-blueprints - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. bnomei/kirby-blueprints

ActiveKirby-plugin[Parsing &amp; Serialization](/categories/parsing)

bnomei/kirby-blueprints
=======================

PHP Class-based Blueprints for Kirby CMS for better type safety and code completion

5.1.3(10mo ago)1976↓100%proprietaryPHPPHP &gt;=8.2CI passing

Since Nov 24Pushed 10mo ago3 watchersCompare

[ Source](https://github.com/bnomei/kirby-blueprints)[ Packagist](https://packagist.org/packages/bnomei/kirby-blueprints)[ RSS](/packages/bnomei-kirby-blueprints/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (24)Used By (0)

Kirby Blueprints with Ink
=========================

[](#kirby-blueprints-with-ink)

[![Kirby 5](https://camo.githubusercontent.com/b1a1b2ccd58e96259a9722c2489d91f40378c01b6c4c3e9fd27ed1d12c269d7c/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f4b697262792f353f636f6c6f723d454343373438)](https://getkirby.com)[![PHP 8.2](https://camo.githubusercontent.com/fd050028b4459f3f6e4db5703412957375ceb180d27951213d421eb2a23c8c8e/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f5048502f382e323f636f6c6f723d3445354239332669636f6e3d706870266c6162656c)](https://camo.githubusercontent.com/fd050028b4459f3f6e4db5703412957375ceb180d27951213d421eb2a23c8c8e/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f5048502f382e323f636f6c6f723d3445354239332669636f6e3d706870266c6162656c)[![Release](https://camo.githubusercontent.com/acb83a68e1c5649f246010af8b53adad455aed378579eb65dd1246c1e108d8c0/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b697262792d626c75657072696e74733f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)](https://camo.githubusercontent.com/acb83a68e1c5649f246010af8b53adad455aed378579eb65dd1246c1e108d8c0/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f626e6f6d65692f6b697262792d626c75657072696e74733f636f6c6f723d6165383166662669636f6e3d676974687562266c6162656c)[![Downloads](https://camo.githubusercontent.com/c5de0eb42e5eea231b6f58eb08a8e926e0b9563993f500566a51651f8ec29284/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b697262792d626c75657072696e74733f636f6c6f723d3237323832322669636f6e3d676974687562266c6162656c)](https://camo.githubusercontent.com/c5de0eb42e5eea231b6f58eb08a8e926e0b9563993f500566a51651f8ec29284/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f626e6f6d65692f6b697262792d626c75657072696e74733f636f6c6f723d3237323832322669636f6e3d676974687562266c6162656c)[![Coverage](https://camo.githubusercontent.com/a7bc1546e9e3966b85a33e6a5c336dd89eab18ea6b83e5bf5a15da0432400478/68747470733a2f2f666c61742e62616467656e2e6e65742f636f6465636c696d6174652f636f7665726167652f626e6f6d65692f6b697262792d626c75657072696e74733f69636f6e3d636f6465636c696d617465266c6162656c)](https://codeclimate.com/github/bnomei/kirby-blueprints)[![Maintainability](https://camo.githubusercontent.com/c9a2eec740508388087577884062e4ef6e88b37ad49b4a74945b192910742701/68747470733a2f2f666c61742e62616467656e2e6e65742f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f626e6f6d65692f6b697262792d626c75657072696e74733f69636f6e3d636f6465636c696d617465266c6162656c)](https://codeclimate.com/github/bnomei/kirby-blueprints/issues)[![Discord](https://camo.githubusercontent.com/36eaef1b06f4996feb7587aa3281dcbd658e57535bc6b5e10110ed108e7a7a03/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f646973636f72642f626e6f6d65693f636f6c6f723d3732383964612669636f6e3d646973636f7264266c6162656c)](https://discordapp.com/users/bnomei)[![Buy License](https://camo.githubusercontent.com/fa0293faad1182b8b58c2984dd6041eb50f85f28cd1d47d440a637eff4d5bdf4/68747470733a2f2f666c61742e62616467656e2e6e65742f62616467652f69636f6e2f4275792532304c6963656e73653f69636f6e3d6c656d6f6e73717565657a6526636f6c6f723d464643323333266c6162656c3d24)](https://buy-blueprints.bnomei.com)

Kirby Blueprints with Ink - PHP Class-based Blueprints for Kirby CMS for better type safety and code completion.

Install
-------

[](#install)

Using composer:

```
composer require bnomei/kirby-blueprints
```

Licensing
---------

[](#licensing)

Kirby Blueprints with Ink is a commercial plugin that requires a license. You can install and test the plugin locally without a license. However, production environments require a valid license. You can [purchase a license here](https://buy-blueprints.bnomei.com).

What's in the box?
------------------

[](#whats-in-the-box)

This plugin introduces two new ways to define blueprints for Kirby.

### Fluent &amp; Named Helper Classes

[](#fluent--named-helper-classes)

Define blueprints in PHP files with the *fluent definition* or *named parameter definition* instead of just the *array definition* that Kirby provides. You can use the`*::make()`-helpers to create them and avoid typos.

**site/plugins/example/blueprints/fields/description.php**

```
return Field::make(FieldTypes::TEXTAREA)
    ->label('Description')
    ->toArray();
```

### PHP Attributes for PageModels

[](#php-attributes-for-pagemodels)

Define blueprints for pages in PageModels and use public properties with PHP attributes to define fields. You will gain auto-completion and insights on hover for the fields in your templates.

**site/plugins/example/models/ArticlePage.php**

```
#[
    Label([
        'en' => 'Introduction',
        'de' => 'Einleitung',
    ]),
    Type(FieldTypes::TEXT),
]
public Field $introduction;
```

Blueprint definitions from Files
--------------------------------

[](#blueprint-definitions-from-files)

### How to make Kirby aware of a blueprint definition

[](#how-to-make-kirby-aware-of-a-blueprint-definition)

Kirby can currently only load blueprints from YAML files if they are stored in the `site/blueprints` folder. It can also load them from PHP files but they need to be defined in a custom plugin with something called *extension*. Give my [suggestion an up-vote](https://kirby.nolt.io/572) if you want to see this changed in the future and be able to use PHP blueprints right from the core folders.

The examples in this Readme show how to create various blueprints. What is not show here is how to register them in the `index.php` of your custom plugin via an extension. See the [official docs](https://getkirby.com/docs/reference/plugins/extensions/blueprints) on how to do that or try my [autoloader helper](https://github.com/bnomei/autoloader-for-kirby).

The following code shows how you would use the *autoloader helper* in your custom plugin. As it's name indicates the helper will automatically scan the folders inside your plugin and register ALL extensions it finds (like blueprints, pageModels, snippets, ... and many more). Meaning that it will also register the blueprints from the `site/plugins/example/blueprints` folder.

**site/plugins/example/index.php**

```
