Skip to content

cuongdinhngo/ezycrazy

Repository files navigation

ezycrazy

Powered by Atom Framework

The Application Structure

  • app: contains logic folders including Controllers, Models, Routes
  • public: contains unrestricted files such as photos, css, js
  • config: contains config files : env.inc, app.php, ...
  • resources: contains all view files.
  • storage: likes local storage to contain log, ...

Single Point Entry

index.php

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

use Atom\Http\Server;

try {
    $server = new Server(['env']);
    $server->handle();
} catch (Exception $e) {
    echo $e->getMessage();
}

Installing/Configuration

  • After cloned, you come to docker folder and run command:
docker-compose up -d
  • Create env.ini file by:
cp env.ini.sample config/env.ini
  • Obtain IPAddress and Update Database host in env.ini
docker inspect docker_ezy_mysql_1 | grep IPAddress
composer install
  • Go to browser with below url and Enjoy it
http://127.0.0.1:8010/admin

MEMO

New Route

New Controller

New Model

  • [Database driver: mysqli] New Model class must be extended BaseModel class
  • [Database driver: pdo_mysql] New Model class must be extended BaseModel class

New Middleware

  • New Middleware must be created in [Middlewares folders(app/Middlewares) and has primary method handle(). Please refer to PhpToJs
  • New Middleware has to declare at config/middleware.php

PHP to JS

  • Atom provides PhpToJs to transform PHP variables to Js variables more detail

Template Provider

  • Set templates at config/templates.php. Item has null value which will be replaced
  • With template() function, please refer to app/Controllers/User/UserController@list()
  • With Template class, please refer to app/Controllers/User/UserController@updateForm()

Doctrine Database Abstract Layer

  • Set DBAL_IN_USE = true and DBAL_PATH_CONFIG = '/../app/Entities' in env file
  • Create an Entity, please refer to Product class
  • Create an Controler, please refer to ProductController class
  • Generate the Database schema
php vendor/doctrine/orm/bin/doctrine orm:schema-tool:create
php vendor/doctrine/orm/bin/doctrine orm:schema-tool:update

GraphQL

About

Powered by Atom Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published