Micro Framework with my own hands

Guliyev Rustam
1 min readAug 24, 2020

Components

I have compiled Micro Framework from the following components:

* For Routing: FastRoute
* For working with HTTP: symfony/http-foundation
* For Dependency Injection: PHP-DI
* For Template Engine: Twig
* For work with Databases: PDO

What to do after cloning a repository?

1. Run composer update
2. Create in folder config file config.php using config.example.php
3. Create, in core, folder cache (chmod 421)

Framework Structure

  • cache
  • config
    * config.php -Basic settings to hide
    *
    di.config.php -Dependency Injection settings
  • public
    * index.php
  • src
    * Controller
    * MainController.php -Parrent class for Controller’s
    * Core

    * Core.php -Parrent class for Controller’s and Model’s
    * Model

    * MainModel.php -Parrent class for Model’s
  • Utilities
    * Database.php -Database connection class
  • View HTML-templates

Parrent method’s (Controller’s and Model’s)

$this->model({CLASSNAME}) referring to models (Controller’s and Model’s)
$this->db()work with Databases (Controller’s and Model’s)
$this->session()work with Session-s (Controller’s and Model’s)
$this->http() work with HTTP Request and HTTP Response (Controller’s)
$this->tmp()work with Template Engine (Controller’s)

I hope this Framework will be useful for you in your work or for an interview

--

--

Guliyev Rustam

PHP-программист, который любит читать и составлять списки.