milkmedia / getcontent
GetContent CMS
Requires
- php: >=7.1.3
- doctrine/dbal: ^2.9
- illuminate/support: ^5.7 || ^5.8
- kalnoy/nestedset: ^4.3
- league/glide-laravel: ^1.0
- loilo/fuse: ^3.3
- owen-it/laravel-auditing: ^8.0 || ^9.0
- spatie/laravel-query-builder: ^1.17.1
- spatie/laravel-schemaless-attributes: ^1.2
Requires (Dev)
- mockery/mockery: ~1.0
- orchestra/testbench: 3.7.*
- orchestra/testbench-dusk: 3.7.*
- phpunit/phpunit: ~7.0
This package is auto-updated.
Last update: 2025-03-01 00:13:06 UTC
README
GetContent CMS is a Laravel package that provides an unstructured, headless content API to use within your own Laravel project. It comes with an user interface to manage content and media out of the box.
Install
Migrations
… Adds a settings
json
column to the users
table.
Routes
routes/api.php
Route::middleware('auth:api')->group(function () {
GetContent::apiRoutes();
});
routes/web.php
Route::middleware('auth')->group(function () {
GetContent::editorRoutes();
});
GetContent::webRoutes();
Users, Authentication and Authorisation
GetContent has it's own User
model that you should extend
Development
Testing
Spin up postgres instance on port 5532
and run phpunit
.
docker-compose -f tests/docker-compose.yml up -d
./vendor/phpunit/phpunit/phpunit
Later…
docker-compose -f tests/docker-compose.yml down
Test Gitlab CI
gitlab-runner exec docker phpunit
Documents
Content is stored within a Document. A Document has a model
and a schema
.
Model
The model is a simple key:value object containing a value
and any other
optional properties you wish.
{
"content1": {
"value": "<p>This is some content</p>"
}
}
Schema
The schema is an array of objects that defines the kind of data stored in the model and how the entry form should be laid out. A schema is fluid by default so you can add any number or fields in any arrangement. However it is possible to created a fixed schema so a given Document has an enforced schema.
[
{
"type": "content",
"model": "content1",
"label": "Body Content",
"instructions": "Enter some content here.",
"options": {}
}
]
Templates
Templates are field type that groups together multiple other fields.
[
{
"type": "template",
"model": "content1",
"template": {
"fields": [
{
"type": "content",
"model": "content1"
},
{
"type": "media",
"model": "media1"
}
]
}
}
]
Or you can use a globally defined template
[
{
"type": "template",
"model": "content1",
"template": "contentWithImage"
}
]
Replicating field sets
A replicating field set allows you to add multiple instances of a set of fields.
[
{
"type": "template",
"model": "socialLinks",
"template": {
"replicator": true,
"sets": [
{
"display": "Social Link",
"fields": {
"url": {
"type": "text",
"model": "url",
"placeholder": "Social profile URL"
}
}
}
]
}
}
]
User Permissions
Users can be restricted to specific areas of content.
Document and Files
{
"permissions": {
"filesRootDirectory": "subdirectory",
"groupRootId": 2
}
}