Usually, each folder in the root of the website is core (but not necessarily).
Core — is a collection of cores, templates, and virtual root folder.
The framework is the core, your folder will also be the core (you need to create it), each core should be stored in separate repositories.

In the simple case, you will have only two cores, for example: /BlackFox for the framework and /Site for your project.
It is possible to add additional cores.
All active cores need to be registered in the /config.php file (the 'cores' key).

The following folders may be located inside the core:


A core — is a structural entity, which is the folder with the file Core.php and other files, including php-classes. The core name is the same as the folder name and namespace. Usually, one top-level namespace without nesting is used.

File Core.php must contain heir class from BlackFox\ACore with class name {YourCoreName}\Core and namespace equals to core name:

<?php namespace Example; class Core extends \BlackFox\ACore { public function GetScheme() {/* ... */} public function Upgrade() {/* ... */} public function Load() {/* ... */} public function Menu() {/* ... */} }
should return an instance of the class Scheme
been called when installing or upgrading a core, use it to synchronize the structure of tables and other amendments (see heirs for an example)
always called if the core is active
called by the admin menu unit, should return an array describing the administrative menu section (see heirs for an example)

Autoload classes

By default, the core scans own subfolders of classes and units, looks for any php-files in them and registers them as classes with the same name in the namespace of the core. Scan depth varies:

Thus, when developing your own core, place classes in a subfolder classes, units in a subfolder units, name files equals to classes inside them, then they will be automatically registered in the engine.

Own autoload classes

If desired, the described above behavior can be overridden. To do this, override the core’s GetClasses method. The method takes no parameters and must return a dictionary:


A model — is a set of classes that describe the business logic of an application.
I recommend placing them in a subfolder classes of the core in order for the engine to register them in autoload.
I recommend to use a single namespace with no nesting to make it convenient to refer to other classes.
A model class can be original or inherit any other class. but generally the model class is a hereditary from SCRUD, describing the structure and access to the database table.


Controllers — are a collection of classes that describe the order of access to the classes and methods of the model and (optional) connects the result of their execution to a view.
A controller class can be original or inherit any other class. but generally the model class is a hereditary from Unit and is located in the subfolder units of the core.

Ask question