Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 1.91 KB

README.md

File metadata and controls

72 lines (51 loc) · 1.91 KB

Cherry-Core

The Cherry-project Core

GitHub license

GitHub release

Packagist Version


This is core for Cherry-Project that contains Cherry Request, Response, Router, and Templater.

In root of your application you must define main file and call application Core Kernel and Router classes:

require_once __DIR__ . '/../vendor/autoload.php';

use Cherry\Routing\Router;

$kernel = new Cherry\Kernel(__DIR__);

$router = new Router();

Kernel class takes only one argument - your application root path.

With main file you mast have directories config, controllers, templates:

root
└─ config/
└─ controllers/
└─ templates/

Config

config directory is a 'home' for application config and router files:

config/
└─ config.json
└─ routes.json

config.json contains application environmental parameters:

{
  "ROUTES_FILE":      "path-to-routes.json",
  "CONTROLLERS_PATH": "path-to-controllers-directory",
  "TEMPLATES_PATH":   "path-to-templates-directory",
  "LOGS_PATH":        "path-to-logs-directory"
}

Controller

Controller is a simple PHP class that contains public methods mapped on route:

"action": "DefaultController::index"

Every method returns Cherry\HttpUtils\Response object.

$this->render('index');

2019 © Cherry-project