1. Go to this page and download the library: Download open-engine/mika library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
open-engine / mika example snippets
$routeConfig = new RouteConfig();
$routeConfig->register('default','App\Main\Controllers');
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');
}
}