PHPackages                             optimuscms/pages - 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. optimuscms/pages

AbandonedArchivedLibrary

optimuscms/pages
================

v0.4.0(6y ago)02091MITPHP

Since Jun 20Pushed 6y ago1 watchersCompare

[ Source](https://github.com/optimuscms/pages)[ Packagist](https://packagist.org/packages/optimuscms/pages)[ RSS](/packages/optimuscms-pages/feed)WikiDiscussions master Synced 2mo ago

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

Optimus Pages
=============

[](#optimus-pages)

This package provides the core backend functionality for creating pages and page templates within the CMS.

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

[](#installation)

This package can be installed through Composer.

```
composer require optimuscms/pages
```

In Laravel 5.5 and above the package will autoregister the service provider.

In Laravel 5.4 you must install this service provider:

```
// config/app.php
'providers' => [
    ...
    Optimus\Pages\PageServiceProvider::class,
    ...
];
```

API Routes
----------

[](#api-routes)

The API follows standard RESTful conventions, with responses being returned in JSON. Appropriate HTTP status codes are provided, and these should be used to check the outcome of an operation.

**Pages**

- [List pages](#list-pages)
- [Get page](#get-page)
- [Create page](#create-page)
- [Update page](#update-page)
- [Delete page](#delete-page)

**Templates**

- [List templates](#list-templates)

### List pages

[](#list-pages)

List all pages.

```
GET /admin/api/pages
```

**Request Body**

ParameterRequiredTypeDescription`parent`No`int`A page ID. When provided will only show pages that have this page as their parent.**Example Response**

```
{
    "data": [
        {
            "id": 1,
            "title": "A root page",
            "slug": "a-root-page",
            "uri": "a-root-page",
            "has_fixed_uri": true,
            "parent_id": null,
            "template": "default",
            "has_fixed_template": true,
            "contents": [
                {
                    "id": 1,
                    "key": "content",
                    "value": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium."
                }
            ],
            "media": [
                {
                    "id": 1,
                    "folder_id": null,
                    "name": "Image",
                    "file_name": "image.jpg",
                    "disk": "public",
                    "mime_type": "image/jpeg",
                    "size": 102400,
                    "group": "image",
                    "created_at": "2018-12-25 10:15:12",
                    "updated_at": "2018-12-25 10:15:12"
                }
            ],
            "children_count": 1,
            "is_stand_alone": false,
            "is_published": true,
            "is_deletable": true,
            "created_at": "2019-02-19 09:36:23",
            "updated_at": "2019-02-19 09:36:23"
        }
    ]
}
```

### Create page

[](#create-page)

Create a new page.

```
POST /admin/api/pages
```

**Request Body**

ParameterRequiredTypeDescription`title`Yes`string`The page title`template`Yes`string`The name of the template that should be applied to this page.`is_stand_alone`Yes`boolean`If false, the page will not appear in any navigation and will only be accessible via a direct link.`is_published`Yes`boolean`Whether the page is ready to be made public.`parent_id`No`int`The ID of a page to nest this one under.`slug`No`string`A URL-friendly identifier. Will be used as part of the final public-facing URL to the page.**Example Response**

Returns the newly created page. See [single page response example](#get-page).

### Get page

[](#get-page)

Get the details of a specific page.

```
GET /admin/api/pages/{id}
```

**Request Body**

None

**Example Response**

```
{
    "data": {
        "id": 2,
        "title": "A sub page",
        "slug": "a-sub-page",
        "uri": "a-root-page/a-sub-page",
        "has_fixed_uri": true,
        "parent_id": 1,
        "template": "default",
        "has_fixed_template": true,
        "contents": [
            {
                "id": 2,
                "key": "content",
                "value": "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium."
            }
        ],
        "media": [
            {
                "id": 1,
                "folder_id": null,
                "name": "Image",
                "file_name": "image.jpg",
                "disk": "public",
                "mime_type": "image/jpeg",
                "size": 102400,
                "group": "image",
                "created_at": "2018-12-25 10:15:12",
                "updated_at": "2018-12-25 10:15:12"
            }
        ],
        "children_count": 0,
        "is_stand_alone": false,
        "is_published": true,
        "is_deletable": true,
        "created_at": "2019-02-19 09:36:23",
        "updated_at": "2019-02-19 09:36:23"
    }
}
```

### Update page

[](#update-page)

Update the details of a specific page.

```
PATCH /admin/api/pages/{id}
```

**Request Body**

ParameterRequiredTypeDescription`title`Yes`string`The page title`template`Yes`string`The name of the template that should be applied to this page.`is_stand_alone`Yes`boolean`If false, the page will not appear in any navigation and will only be accessible via a direct link.`is_published`Yes`boolean`Whether the page is ready to be made public.`parent_id`No`int`The ID of a page to nest this one under.`slug`No`string`A URL-friendly identifier. Will be used as part of the final public-facing URL to the page.**Example Response**

Returns the updated page. See [single page response example](#get-page).

### Delete page

[](#delete-page)

Delete a specific page.

```
DELETE /admin/api/pages/{id}
```

**Request Body**

None

**Example Response**

The HTTP status code will be `204` if successful.

### List templates

[](#list-templates)

List all available templates.

```
GET /admin/api/page-templates
```

**Request Body**

None

**Example Response**

```
{
    "data": [
        {
            "name": "home",
            "label": "Home"
        },
        {
            "name": "default",
            "label": "Default"
        }
    ]
}
```

### Working with page templates

[](#working-with-page-templates)

#### Create a template

[](#create-a-template)

```
use Optimus\Pages\Template;
use Illuminate\Http\Request;
use Optimus\Pages\Models\Page;

class DefaultTemplate extends Template
{
    public function name(): string
    {
        return 'default';
    }

    public function label(): string
    {
        return 'A custom label';
    }

    public function validate(Request $request)
    {
        $request->validate([
            'content' => 'required'
        ]);
    }

    public function save(Page $page, Request $request)
    {
        $page->addContents([
            'content' => $request->input('content')
        ]);

        $page->attachMedia($request->input('media_id'));
    }
}
```

#### Register and retrieve templates

[](#register-and-retrieve-templates)

```
use Optimus\Pages\Facades\Template;

// Get all the registered templates...
Template::all();

// Get the template with the given name...
Template::find($name);

// Register a template...
Template::register(new DefaultTemplate);

// Register multiple templates...
Template::registerMany([
    new HomeTemplate,
    new ContactTemplate
]);
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 90.6% 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 ~38 days

Total

12

Last Release

2466d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c751a806a8c52afaca5c461326a0799033af6dc94f9ff1f4ee767565d7f83b7?d=identicon)[optimuscms](/maintainers/optimuscms)

---

Top Contributors

[![Jack97](https://avatars.githubusercontent.com/u/19285044?v=4)](https://github.com/Jack97 "Jack97 (48 commits)")[![coatesap](https://avatars.githubusercontent.com/u/1926626?v=4)](https://github.com/coatesap "coatesap (4 commits)")[![r1chm8](https://avatars.githubusercontent.com/u/25925437?v=4)](https://github.com/r1chm8 "r1chm8 (1 commits)")

### Embed Badge

![Health badge](/badges/optimuscms-pages/health.svg)

```
[![Health](https://phpackages.com/badges/optimuscms-pages/health.svg)](https://phpackages.com/packages/optimuscms-pages)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)

PHPackages © 2026

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