PHP code example of remetulla / tinymvc-php

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

    

remetulla / tinymvc-php example snippets




namespace app\controllers;

use app\Controller;

class SiteController extends Controller
{
    public function actionIndex()
    {
        return $this->render('index', ['title' => 'Hello']);
    }

    public function actionView(int $id)
    {
        return $this->render('view', ['id' => $id]);
    }
}

return [
  'components' => [
    'user' => ['class' => '\app\AuthService'],
    'urlManager' => ['class' => '\app\UrlManager'],
    'response' => ['class' => '\app\Response'],
    'lang' => ['class' => '\app\helpers\I18n'],
    'session' => ['class' => '\app\helpers\Session'],
  ],
];

use app\App;

echo App::$app->t('app', 'Hello');

return [
  'dsn' => 'mysql:host=localhost;dbname=auth;charset=utf8',
  'user' => 'root',
  'password' => 'root',
];
bash
php bin/console.php help
bash
php bin/console.php make:controller Site
# или в модуль:
php bin/console.php make:controller Site --module=admin
bash
php bin/console.php make:model User --table=user
bash
php bin/console.php make:crud User --table=user
# CRUD внутрь модуля:
php bin/console.php make:crud User --table=user --module=admin --force
bash
php bin/console.php make:module admin
bash
php bin/console.php make:migration create_user_table
bash
php bin/console.php migrate
bash
php bin/console.php migrate down 1