PHPackages                             luyadev/luya-headless-cms-api - 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. luyadev/luya-headless-cms-api

ActiveLuya-module

luyadev/luya-headless-cms-api
=============================

The bridge between your SPA application and the LUYA CMS Module.

17.2k3[1 issues](https://github.com/luyadev/luya-headless-cms-api/issues)PHP

Since Jun 14Pushed 3y ago1 watchersCompare

[ Source](https://github.com/luyadev/luya-headless-cms-api)[ Packagist](https://packagist.org/packages/luyadev/luya-headless-cms-api)[ RSS](/packages/luyadev-luya-headless-cms-api/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

 [![LUYA Logo](https://raw.githubusercontent.com/luyadev/luya/master/docs/logo/luya-logo-0.2x.png)](https://raw.githubusercontent.com/luyadev/luya/master/docs/logo/luya-logo-0.2x.png)

LUYA HEADLESS CMS API BRIDGE
============================

[](#luya-headless-cms-api-bridge)

[![LUYA](https://camo.githubusercontent.com/c30b61934591d3a6fcb8718a93fd61bf840c0abd8a8d49aa0fdd4ab99567bdf4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f776572656425323062792d4c5559412d627269676874677265656e2e737667)](https://luya.io)

This module provides and out of the box ready **API** in order to consume the LUYA CMS informations.

- The API is public and therefore requires no authentication.
- CORS works out of the box.
- Only required informations will be exposed to public.
- Its optimized with caching, which makes it very fast!

This can turn your exists LUYA CMS website into an API which you can use to build your website! This can be either frontend (JavaScript, Vue, React) or any backend technology.

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

[](#installation)

Install the extension through composer:

```
composer require luyadev/luya-headless-cms-api
```

Add the module to the config

```
'modules' => [
    //...
    'api' => [
        'class' => 'luya\headless\cms\api\Module',
    ]
]
```

The module name is equal to the rest api url. When you register the module as `foobar` in the config the api would be available as `/foobar/menu?langId=x`. By default its `api`. All APIs expect a GET request.

### Menu

[](#menu)

All APIs which are handling Menu Data - helping you to build the navigation in layout files.

/api/menu/containers ─ Get ContainersReturns all available CMS Menu Containers. LUYA will create a `content` default container while setup.

/api/menu?langId={int} ─ Get Menu TreeReturns the page tree (menu) for a given language `api/menu?langId=1`. In order to return only visible items add `&onlyVisible=1`. Example response:

```
{
  "default": {
    "id": 1,
    "name": "Menu",
    "alias": "default",
    "items": [
      {
        "id": 1,
        "index": 1,
        "nav_id": 1,
        "lang_id": 1,
        "is_hidden": true,
        "is_home": true,
        "title": "Startseite",
        "title_tag": null,
        "alias": "startseite",
        "path": "startseite",
        "description": null,
        "children": [],
        "has_children": false
      },
      {
        "id": 2,
        "index": 2,
        "nav_id": 2,
        "lang_id": 1,
        "is_hidden": false,
        "is_home": false,
        "title": "Lets Talk",
        "title_tag": "",
        "alias": "letstalk",
        "path": "letstalk",
        "description": "Genuss und Freude.",
        "children": [],
        "has_children": false
      },
      {
        "id": 3,
        "index": 4,
        "nav_id": 3,
        "lang_id": 1,
        "is_hidden": false,
        "is_home": false,
        "title": "About Me",
        "title_tag": null,
        "alias": "aboutme",
        "path": "aboutme",
        "description": null,
        "children": [],
        "has_children": false
      }
    ]
  },
  "footer": {
    "id": 2,
    "name": "Footer",
    "alias": "footer",
    "items": [
      {
        "id": 6,
        "index": 1,
        "nav_id": 6,
        "lang_id": 1,
        "is_hidden": false,
        "is_home": false,
        "title": "Datenschutz",
        "title_tag": null,
        "alias": "datenschutz",
        "path": "datenschutz",
        "description": null,
        "children": [],
        "has_children": false
      },
      {
        "id": 7,
        "index": 2,
        "nav_id": 7,
        "lang_id": 1,
        "is_hidden": false,
        "is_home": false,
        "title": "Impressum",
        "title_tag": null,
        "alias": "impressum",
        "path": "impressum",
        "description": null,
        "children": [],
        "has_children": false
      }
    ]
  }
}
```

### Content

[](#content)

All APIs which helps you to build the content for a given page, mostly by handling the blocks for a given page id.

/api/page?id={int|string} ─ Get Page BlocksReturns the placeholders with all blocks for a certain page (nav item) `api/page?id=8`. Its also possible to provide the page slug (alias) `api/page?id=home`. The response contains an object with `page`, `placeholders`, `layout` and `properties`.

Example Response:

```
{
   "page":{
      "id":1,
      "nav_id":1,
      "lang_id":1,
      "title":"Startseite",
      "alias":"startseite",
      "description":null,
      "keywords":null,
      "title_tag":null
   },
   "placeholders":{
      "content":[
         {
            "id":13,
            "index":0,
            "block_id":2,
            "block_name":"HtmlBlock",
            "full_block_name":"LuyaCmsFrontendBlocksHtmlBlock",
            "is_container":false,
            "values":{
               "html":"......."
            },
            "cfgs":{
               "raw":null
            },
            "extras":[]
         },
      ]
   },
   "layout":{
      "id":1,
      "name":"Default"
   },
   "properties":{
      "VarName":null
   }
}
```

/api/page/nav?id={int}&amp;langId={int} ─ Get Page Language Context BlocksReturns the placeholders with all blocks for a certain nav id with the corresponding language id.

/api/page/home?langId={int} ─ Get Homepage Page BlocksReturns the content of the homepage for the given language.

VUE
---

[](#vue)

> Proof of concept example in VUE

Create a component for the given Element, in this case we are using the Html Block `LuyaCmsFrontendBlocksHtmlBlock.vue`:

```

export default {
  props: {
    block: Object
  }
}

```

Create a component which loads the page and foreaches the components:

```

      {{ this.title }}

import LuyaCmsFrontendBlocksHtmlBlock from '../../components/LuyaCmsFrontendBlocksHtmlBlock.vue'

export default {
  components: { LuyaCmsFrontendBlocksHtmlBlock },
  data: () => ({
    isLoaded: false,
    response: null
  }),
  computed: {
    contentPlaceholder () {
      return this.isLoaded ? this.response.placeholders.content : []
    }
  },
  async mounted () {
    const { data } = await this.$axios('page?id=' + this.$route.params.slug)
    this.response = data
    this.isLoaded = true
  }
}

```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 82% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/86184bf08843ed8fcc4aedb2fdecd8a9e832e47e89a7166cebfda529c176f5ce?d=identicon)[nadar](/maintainers/nadar)

---

Top Contributors

[![nadar](https://avatars.githubusercontent.com/u/3417221?v=4)](https://github.com/nadar "nadar (50 commits)")[![chemezov](https://avatars.githubusercontent.com/u/2368902?v=4)](https://github.com/chemezov "chemezov (7 commits)")[![dven84](https://avatars.githubusercontent.com/u/10542161?v=4)](https://github.com/dven84 "dven84 (2 commits)")[![hbugdoll](https://avatars.githubusercontent.com/u/6715827?v=4)](https://github.com/hbugdoll "hbugdoll (2 commits)")

### Embed Badge

![Health badge](/badges/luyadev-luya-headless-cms-api/health.svg)

```
[![Health](https://phpackages.com/badges/luyadev-luya-headless-cms-api/health.svg)](https://phpackages.com/packages/luyadev-luya-headless-cms-api)
```

PHPackages © 2026

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