PHPackages                             polyctopus/core - 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. [Framework](/categories/framework)
4. /
5. polyctopus/core

ActiveLibrary[Framework](/categories/framework)

polyctopus/core
===============

A modern, modular PHP library for multidimensional, multilingual content management with versioning, variants, translations, and asset handling.

v0.0.14(10mo ago)06[1 PRs](https://github.com/polyctopus/core/pulls)LGPL-3.0-or-laterPHPPHP &gt;=8.3CI passing

Since Jun 20Pushed 3mo agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (17)Used By (0)

Polyctopus Core
===============

[](#polyctopus-core)

Polyctopus Core is a lightweight PHP library for managing structured content and content types, inspired by headless CMS concepts. It provides a flexible, type-safe way to define content models, fields, and to manage content instances in your application.

Features
--------

[](#features)

- **Versioning and rollback** for content entries
- **Content Dimensions**: Support for content variants based on arbitrary dimensions (e.g. brands, channels, campaigns)
- **Multilingual content and variants**: Optional translations for any content or variant using locales (e.g. `de_DE`)
- **Event mechanism** for custom application logic based on triggered events by accepting callbacks
- **Structured validation errors** for better error handling
- **Test utilities** for easy test data setup

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

[](#requirements)

- PHP 8.3 or higher

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

[](#installation)

Install via Composer (assuming you have a `composer.json`):

```
composer require polyctopus/core
```

Service Structure
-----------------

[](#service-structure)

Polyctopus Core uses a modular service structure for clear separation of concerns:

- `ContentService`: Core operations for content (create, update, delete, rollback, resolve, etc.)
- `ContentTypeService`: Manage content types (create, update, delete, list)
- `ContentVariantService`: Manage content variants for dimensions
- `ContentTranslationService`: Manage translations for content and variants
- `ContentVersionService`: Manage content versioning and rollback

You typically obtain all services pre-wired via the `InMemoryContentServiceFactory` or a similar factory. The ContentService is the main entry point for all operations, and it uses the other services internally.

**Example:**

```
use Polyctopus\Core\Services\InMemoryContentServiceFactory;

$service = InMemoryContentServiceFactory::create(); // returns a ContentService with all dependencies
$service->contentTypeService->createContentType(TestFactory::contentTypeWithTextField('article'));
```

Creating Content
----------------

[](#creating-content)

```
use Polyctopus\Core\Models\ContentStatus;

// Create a new Content (valid)
$content = $service->createContent('c1', $contentType, ['title' => 'Hello', 'contact' => 'info@example.com']);
echo "Created content: " . print_r($content->toArray(), true) . PHP_EOL;

// Update Content (valid and status change)
$service->updateContent($content, ContentStatus::Published, ['title' => 'Updated Title', 'contact' => 'info@example.com']);
$updated = $service->findContent('c1');
echo "Updated content: " . print_r($updated->toArray(), true) . PHP_EOL;
```

Validation
----------

[](#validation)

When creating or updating content, the service automatically validates the data against the field definitions of the content type.
If validation fails (e.g. a string is too long), a `ValidationException` is thrown, containing structured error objects.

**Example:**

```
try {
    $service->createContent('c2', $contentType, ['title' => str_repeat('A', 300)]);
} catch (\Polyctopus\Core\Exceptions\ValidationException $e) {
    foreach ($e->getErrors() as $error) {
        echo "Field: {$error->field}, Value: " . var_export($error->value, true) . ", Message: {$error->message}\n";
    }
}
```

Extending
---------

[](#extending)

- Add new field types by implementing `FieldTypeInterface`.
- Implement your own repositories for persistent storage by extending `ContentRepositoryInterface` and `ContentVersionRepositoryInterface`.
- Create custom validation rules by implementing `FieldTypeInterface` or custom logic in your service.
- Use the provided `TestFactory` for easy test data setup in your tests.

Usage Example
-------------

[](#usage-example)

See the `example-usage.php` file in the repository for a complete example of how to use the library.

Content Types
-------------

[](#content-types)

- [Content Types](docs/ContentTypes.md)

Content Variants (Dimension Overrides)
--------------------------------------

[](#content-variants-dimension-overrides)

- [Content Variants](docs/ContentVariants.md)

Multilingual Content &amp; Translations
---------------------------------------

[](#multilingual-content--translations)

- [Translations](docs/Translations.md)

Publish Scheduling
------------------

[](#publish-scheduling)

- [Publish Start &amp; End Dates](docs/Publishing.md)

Event Mechanism
---------------

[](#event-mechanism)

- [Events](docs/Events.md)

Versioning &amp; Rollback
-------------------------

[](#versioning--rollback)

- [Versioning &amp; Rollback](docs/Versioning.md)

Asset Handling
--------------

[](#asset-handling)

- [Asset Handling](docs/Assets.md)

Contributing
------------

[](#contributing)

Contributions are welcome! Please create a pull request or open an issue for discussion.

License
-------

[](#license)

LGPL-3.0-or-later

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance68

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

Total

14

Last Release

313d ago

PHP version history (2 changes)v0.0.1PHP &gt;=8.2

v0.0.2PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/b9d690a2688acee1eb8b1f145c93ab51fbf481f633ffb03d85d6f9fa217d59b0?d=identicon)[laracoder](/maintainers/laracoder)

---

Top Contributors

[![laracoder](https://avatars.githubusercontent.com/u/5011321?v=4)](https://github.com/laracoder "laracoder (3 commits)")

---

Tags

cmscontentcontent-management-systemmodulemulti-dimensionalphpframeworktranslationslibrarymultilingualcontentcmsversioningassetscontent managementmultidimensionalcontent typespolyctopuscontent variants

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/polyctopus-core/health.svg)

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

###  Alternatives

[luyadev/luya

LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.

8086.9k2](/packages/luyadev-luya)[luyadev/luya-module-cms

The LUYA CMS module provides a full functional Content Management System for adding contents based on blocks.

32176.1k18](/packages/luyadev-luya-module-cms)[kompo/kompo

Laravel &amp; Vue.js FullStack Components for Rapid Application Development

11812.4k21](/packages/kompo-kompo)[digitalstars/simplevk

Powerful PHP library/framework for VK API bots, supporting LongPoll &amp; Callback &amp; OAuth

883.9k3](/packages/digitalstars-simplevk)

PHPackages © 2026

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