Quick Start

Zemit is currently built on top of PHP 7.4 + Phalcon v4, but we are in the progress of migrating everything to PHP 8.2 + Phalcon v5.

Information

Since Zemit is built on top of Phalcon PHP, you can always refer yourself to the Official Phalcon PHP Documentation.

Install Zemit CMS

The best way to interact with our API is to use one of our official libraries:

Zemit App is the default skeleton project to start from, this package includes the backend (Zemit Core) as well as the frontend (Zemit Admin).

# Create a new porject using Composer
composer create-project zemit-cms/app

Web Server

You can use the Web Server of your choice and use the ./public/index.php file as the entry point.

In order for the routing for a Phalcon application to work, you will need to set up your web server in a way that it will process redirects properly. Please refer yourself to the official Phalcon Webserver Documentation for more information.

Loader

The loader component serves as an autoloader, adhering to the PSR-4 standard. As with any autoloader, it performs the task of locating the files your code references, such as classes, based on various criteria like file names, class names, and namespaces. One notable advantage of Phalcon\Loader is its implementation in C, which ensures minimal overhead during the setup process. This inherent efficiency contributes to a performance boost for your application.

Constants

Those constants are used during the loading, the configuration as well as the bootstrap process of the application. You can adjust the values to your needs.

ConstantDefault ValueDescription

APP_NAMESPACE

App

Application's main namespace.

ROOT_PATH

__DIR__

Should be the root directory of your application path on the server.

VENDOR_PATH

/vendor

Vendor folder

APP_PATH

/app

Application folder

We are registering the vendor autoload.php and the application namespace. You can also register more files, classes and namespaces to fit your needs. Below you can find what the base should look like:

// ./loader.php
<?php

use Phalcon\Loader;

const APP_NAMESPACE = 'App';
const ROOT_PATH = __DIR__;
const VENDOR_PATH = ROOT_PATH . '/vendor';
const APP_PATH = ROOT_PATH . '/app';

$loader = new Loader();
$loader->registerFiles([VENDOR_PATH . '/autoload.php']);
$loader->registerNamespaces([APP_NAMESPACE => APP_PATH]);
$loader->register();

return $loader;

Entry Point

The index will use the loader in order to register elements into the autoloading system and then run your App\Boostrap.

// ./index.php
<?php

use App\Bootstrap;

$loader = require 'loader.php';
echo (new Bootstrap())->run();

This is what the <root>/public/index.php entry point file should look like.

// ./public/index.php
<?php

require '../index.php';

Last updated