PHP code example of emilianozublena / mikro-php

1. Go to this page and download the library: Download emilianozublena/mikro-php 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/ */

    

emilianozublena / mikro-php example snippets


composer 

$container = (ntainer->get('kernel');
$kernel->initCore();


$container = (et('response');
$exampleResponse = $esponse->create(
    JsonResponse::class,
    ['message' => 'OK!'],
    Response::HTTP_OK
);



namespace Mikro\Http\Controllers;

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;

class Home extends Controller
{
    public function index(){
        $response = $this->container->get('response');

        return $response->create(
           JsonResponse::class,
           [
               'message' => 'Some message'
           ],
           Response::HTTP_OK
       );
    }
}



namespace Mikro\Http\Controllers;

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;

class Home extends Controller
{
    public function index(){
        $view = $this->container->get('view');

        return $view->file('book')->render([
            'hola' => 'chau'
        ])->getResponse();
    }
}

<div class="container">
    <header><h1>Mikro Php Books</h1></header>
    <nav>
        <a href=" echo $this->url('books/create') 


namespace Mikro\Models;

use Illuminate\Database\Eloquent\Model;

class Book extends Model
{
    protected $fillable = ['name', 'author', 'shelf_id'];
    protected $with = ['shelf'];
}

<a class="btn btn-primary" href=" echo $this->url('books/' . $book->id . '/updat') 

<link href=" echo $this->asset('css', 'style.css'); 

cd src/
cd migrations
php eloquent_migrations.php