solenoid/core

HTTP MVC Framework

v1.0.0-beta 2023-12-17 22:25 UTC

This package is auto-updated.

Last update: 2024-09-18 00:13:44 UTC


README

Core is a smart HTTP/CLI MVC framework for building easy or very complex endpoints with a large set of integrated backend libraries.

The current project contains a sample web app to make developers easier to learn the internal logic of this framework.

For the official and complete documentation you should navigate to Knowledge Base.

Solenoid Core Logo



Setup

To create a new Core project you just have to run the following commands from your terminal :

git clone https://github.com/Solenoid-IT/php-core ./core
cd ./core/private
php x init

Requirements

OS >= Ubuntu 22.04.1 LTS
WebServer >= Apache 2.4
Runtime-Environment >= PHP 7.3

Contexts

Core can run both HTTP and CLI contexts with the same codebase :

HTTP = path resolver -> gate -> middleware groups -> controller -> response
CLI = task runner -> response

Store, model and service objects are shared between HTTP and CLI so they are defined once and are usable on both contexts.

Logs

Core will capture and log both all of the thrown errors and every execution call

Environments

Core give you the ability to run under different specialized environment types ("dev" and "prod" are the reserved ones but you can define your custom ones) :

dev = This type will show you every error in the system and use uncached version of the web assets (css, js or other static resources) when you define the asset url with the function Core::asset

prod = This type will hide every error from the system (security issues) and use cached version of the web assets to improve the frontend performance and ux

custom = This type can be defined in a custom way

( Error logs will be tracked independently from the current environment settings )

Utility

Core has an integrated top-level CLI utility "x" to make some useful operations like to initialize the project, install packages, manage git repos, creating objects (stores, models, services, middlewares or controllers), manage apache, certs and crons.

Routes

Core has a map-file to define how to resolve a request by its URL path.

Route -> Goes to a destination object (you can attach multiple middleware groups or tags to it)
Path -> Can be static or dynamic (containing placeholder-variables)
Verb -> HTTP verb of the path (ex. GET, RPC, SSE or DELETE)
Destination -> Object that will run the stack ( gate -> middleware groups -> controller )

Integrations

Core has a built-in support for SvelteKit as frontend JS framework.
You can install it by executing : php x svelte install

UI

This project uses the sb-admin as UI template

Performance

Memory used for bootstrapping (minimal consumption) :

HTTP -> 216 B
CLI -> 96 B

License

Solenoid Core framework is subjected to MIT license so it is opensource friendly