obsidian-moon/framework

An Open Source, Lightweight and 100% Modular Framework in PHP

2.1.0 2022-12-01 17:59 UTC

This package is auto-updated.

Last update: 2024-04-29 05:05:44 UTC


README

Installing Obsidian Moon Framework

Because Obsidian Moon Engine uses Composer, you will need to install it before you can run the code with it. Once you have installed Composer you will then be able to install it by running the following command:

composer create-project obsidian-moon/framework

Once installed you can change the namespace of your application's files by entering the following into the composer.json file:

{
  "autoload": {
    "class-map": ["app/"],
    "files": ["app/mix.php"],
    "psr-4": {
      "ObsidianMoon\\Framework\\": "app/"
    }
  }
}

File Structure

Once installed, you will find that the application will consist of the following structure.

.
|-- app/                // Application namespace root
|   |-- Controllers/    // Controllers for handling routes
|   |-- Entity/         // For storing entities, to be explained later
|   |-- Modules/        // Modular classes for handling various functionality 
|-- config/             // For the presession modifications used by OME
|   |-- environment.php // Modifies system values if needed, before the session is started
|   |-- routes.php      // Routes for the application
|-- node_modules/       // If you use something like webpack, you would .gitignore this folder.
|-- public/             // Contains all the files that are available to user, eg. js, css, images, etc.
|   |-- .htaccess       // Look in examples for how to best set this
|   |-- index.php       // The primary entry point to your application.
|   |-- ...
|-- src/                // Required library directory used by OME
|   |-- js/             // Store your JS source files for webpack
|   |-- scss/           // SCSS that will be processed by webpack
|   |-- views/          // All view files will go in here
|   |-- ...             
|-- vendor/             // Composer files needed for application, you can gitignore this
|-- common.php
|-- composer.json
|-- ...

Apache Support

If you use apache you will be able to start setting up the routing by using the following in an .htaccess file in the app's public folder:

<IfModule mod_rewrite.c>
    # Enabling the mod_rewrite module in this folder
    RewriteEngine On
    Options -Indexes

    # Redirects invalid locations to index
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

A more complete .htaccess file with caching has been included in the public folder.

Overview of the Base Methods

The framework uses Obsidian Moon Engine, and you can find more details regarding the methods in its README.md

Credits

Obsidian Moon Framework builds on top of Obsidian Moon Engine and uses the following libraries and projects in its development: