2017 © Pedro Peláez
 

project mongolium

A simple MongoDB based CMS powered by APIs

image

mongolium/mongolium

A simple MongoDB based CMS powered by APIs

  • Thursday, April 26, 2018
  • by RobDWaller
  • Repository
  • 0 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Mongolium Core

Build Status codecov StyleCI, (*1)

A PHP and MongoDB based CMS for developers that delivers data via APIs and services only., (*2)

Notes

This is an alpha project currently, it can be tested but must not be used in production environment., (*3)

System Requirements

  • PHP >= 7.0
  • MongoDB = 3.0

Installation

To install Mongolium using composer:, (*4)

// For now just use dev-master while this project is in alpha

composer create-project --prefer-dist mongolium/mongolium test dev-master

Once installed run the Mongolium helper script, this will add an admin to the database so you can start using the API. It will output a username and password., (*5)

php mongolium

Overview

Mongolium is composed of four layers., (*6)

  • Controllers: manage restful requests, interacts with the services layer and returns JSON for the API.
  • Services: core business logic, provides application interfaces to access and process all data.
  • Models: strongly defined value objects / entities that provide structure to the Mongo objects and collections.
  • ORM: responsible for hydrating the model entities with data returned from Mongo before passing them back to the services layer.

API Endpoints

All API endpoints sit under the namespace api., (*7)

POST http://localhost/api/token // Create a JWT token [basic authentication required]
PATCH http://localhost/api/token // Update a JWT token [authentication required]

GET http://localhost/api/admins // Get a list of admins [authentication required]
GET http://localhost/api/admins/{id} // Get individual admin [authentication required]
POST http://localhost/api/admins // Create admin [authentication required]
PATCH http://localhost/api/admins // Update admin [authentication required]
DELETE http://localhost/api/admins/{id} // Delete individual admin [authentication required]

GET http://localhost/api/posts // Get a list of posts
GET http://localhost/api/posts/{id} // Get individual post
POST http://localhost/api/posts // Create post [authentication required]
PATCH http://localhost/api/posts // Update post [authentication required]
DELETE http://localhost/api/posts/{id} // Delete individual post [authentication required]

GET http://localhost/api/pages // Get a list of pages
GET http://localhost/api/pages/{id} // Get individual page
POST http://localhost/api/pages // Create page [authentication required]
PATCH http://localhost/api/pages // Update page [authentication required]
DELETE http://localhost/api/pages/{id} // Delete individual page [authentication required]

API Authentication

All API authentication requires you to use the authorization header which is processed by middleware placed on the relevant routes., (*8)

  • Basic: send a base65 encoded username and password separated by a colon via the basic authorisation protocol. This type of authentication is only used to generate a new JWT token. eg: Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
  • Bearer: send a JSON Web Token as a bearer token in the authorization header. eg: Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.XbPfbIHMI6arZ3Y922BhjWgQzWXcXNrz0ogtVhfEd2o

Extension

Mongolium is setup to provide some basic CMS functionality out of the box. It is also open to extension and development in any way you see fit. It is advised that rather than editing the core files you place your extensions along with your new controllers, services and models in the src/App directory., (*9)

Author

Rob Waller @RobDWaller, (*10)

The Versions