PHPackages                             spiral/pieces - 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. spiral/pieces

AbandonedArchivedLibrary

spiral/pieces
=============

Spiral Framework Pieces Module

v1.0.8(8y ago)0142MITPHPPHP &gt;=7.0

Since Mar 6Pushed 8y ago2 watchersCompare

[ Source](https://github.com/spiral-modules/cms-pieces)[ Packagist](https://packagist.org/packages/spiral/pieces)[ RSS](/packages/spiral-pieces/feed)WikiDiscussions master Synced 4d ago

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

Pieces Module
=============

[](#pieces-module)

This module provide ability to store page pieces data in database (currently ORM only) and access it via Web-API. Also it's compiles two versions of views: one for site editor and one for common site user. The functionality can be sometimes useful especially with something like [WriteAway](https://writeaway.github.io/).

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

[](#installation)

```
$ composer require spiral/pieces
$ ./spiral register spiral/pieces
$ ./spiral up
```

### Add Bootloader

[](#add-bootloader)

```
const LOAD = [
    //...
    \Spiral\Pieces\Bootloaders\PiecesBootloaders::class,
]
```

### Configure permissions

[](#configure-permissions)

Check `app/config/modules/pieces.php` for details.

### Metadata

[](#metadata)

There are two alternatives to include metadata to your pages: "static" and "runtime". First one will fully compile during views compilation and there will be no requests to database during page load. Second one will not.

```

```

The code above is "static" metadata. You can optionally pass some defaults: `title`, `description`, `keywords` arguments and put custom default html (see code above).

If you need something a bit more complex than dumb static pages, then currently you need to use "runtime" metadata. In opposite to "static" metadata you should pass `namespace`, `view` and `code`arguments, but `title`, `description` and `keywords` are still optional.

```
