Skip to content

open-engine/mika

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Latest Stable Version Code Quality Code intelligence Powered By Mika License

Mika

Mika PHP Framework

Templates

https://github.com/open-engine/mika-project-template

Misc

To start tests run

bin/tests

Route

$routeConfig = new RouteConfig();
$routeConfig->register('default','App\Main\Controllers');

Controller

namespace App\Main\Controllers;

use App\Main\Models\Foo;
use Doctrine\ORM\EntityManagerInterface;
use OpenEngine\Mika\Core\Components\Http\Message\Response\Response;

/**
 * Class DefaultController
 * @package App\Main\Controllers
 */
class DefaultController
{
    /**
     * @return Response
     */
    public function defaultAction(): Response
    {
        return new Response('Hello World!');
    }
    /**
     * @param EntityManagerInterface $em
     * @param int $id
     * @return Response
     */
    public function fooAction(EntityManagerInterface $em, int $id): Response
    {
        $em->getRepository(Foo::class)->find($id);
        
        // ... code....

        return new Response('Doctrine Test');
    }
}

Events

Route has 2 events - before and after calling controller action

BeforeCallActionEvent::class;
AfterCallActionEvent::class;

There is you can find all Events. Link (todo)