Folder Structure

How neoan3 is structured

CLI templating

You can influence the cli-generated output with templates. To do so, place a folder _template in your project. Basic variable support works with double curly braces without spaces ( {{example}} ) The following files are respected:

Template File Entity Vairable Note
api.php component (API) name, frame
route.php component (Route) name, frame
view.html component (Route) name
ce.php Custom element name *PHP files for custom element is only generated if template is present
ce.js Custom element name
ce.html Custom element name
transformer.php Model transformer name, structure *Transformer usage requires neoan3-apps/transformer

If the the cli-command `neoan3 new [transformer/component] <name>` finds the according template, it generates files accordingly. Want to learn more about cli-templating?

github.com/neoan3/cli#templates

Asset folder

This folder is intended to hold static files of all sorts and neoan3 holds no opinion on the deeper structure.
Classically, you might want to have aan image and/or upload folder within it.

Component folder

This folder holds hybrid, route, api and custom components. Components must have their own, lower case directory.
Note that neoan3's routing system performs a kebab-to-camel-case transformation when evaluating routes.
This means that

your-app.com/my-component/ targets the component
/component/myComponent

learn more about components

Frame folder

Frames are a unique and vital piece to a Neoan3. Frames hold global information & functionality and hook into the framework's Serve class. As such, a frame tends to provide project-specific settings like the HTML skeleton, used CSS, includes, apps etc. Components can either extend a particular frame (default behavior of API-components), construct them via the unicore singleton or use them as instance ( new MyFrameName() ).

learn more about frames

Model folder

Neoan3 follows an MVC-approach that isn't obvious when looking at the folder structure. Models, however, do have their own directories within the model-folder. While static use is encouraged due to some third party apps, Neoan3 does not dictate a certain structure.

learn more about models

default.php

This file is requested early in the initiation process and facilitates the possibility to hook into early events. After installation, the default controller (usually a route controller) and 404-controller are already defined. In most use-cases, you will want to change at least the value of default_ctrl to your "homepage" controller. For example, if your application has a "home" route component with your start page, your default.php could look like this:


                    <?php
                    // default route (homepage)
                    define('default_ctrl','home');

                    // optional: custom 404
                    define('default_404','notFound');

                    // optional: react on early events
                    Event::listen('Core\Route::notFound', function($call){
                        // redirect?
                    })
                 

.htaccess & Apache

When running Neoan3 on Apache, the easiest way to set up intended behavior is using the provided .htaccess. In most cases, you likely want to change the "RewriteBase" to "/" (assuming your web-root equals the application root). Neoan3 requires mod_rewrite to be available.