amiraslanaslani / Dor-Framework

Simple Personal PHP Framework
0 stars 0 forks source link

d'Or Project

Very simple PHP framework. This frame work's main idea is based on Symfony framework and laravel Framework. I use Twig as template engine, Eloquent as ORM and some of Symfony components in d'Or framework.

Note: If there is any feature that may good to exists, then create new issue and tell it to me.

Directories

Console

There is our console that we can use to do some exciting works! This console is created with Symfony console component. You can use console with executing console file that located at root of repository.

~/DorFramework$ php ./console <Your Command>

Commands

There is some of important commands:

Controllers

Routing

There is you can use annotations to set routing in the system. There is a example of very very simple controller just to show how you can use annotations to routing:

<?php

namespace Dor\Controller;

use Dor\Util\AbstractController;
use Dor\Util\Request;

class MainController extends AbstractController
{
    /**
     * @Route(/page/{id}, /post/{id})
     */
    public function index(Request $req){
        $body = 'This Article\'s id is ' . $req->inputParams['id'];
        return $this->getResponse($body);
    }

    /**
     * @Route(/login)
     * @Method(post, get)
     */
    public function login(){
        $body = 'There is a exciting login page that just you can not see that! :D';
        return $this->getResponse($body);
    }

    /**
     * @Route(/hi)
     * @Method(post)
     */
    public function sayHi(){
        return $this->getResponse("<h1>Hi!</h1>");
    }
}

You can use single or set of parameters to pass to Route or Method.