1. Go to this page and download the library: Download slimmy/framework 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/ */
slimmy / framework example snippets
// app/controllers/UserController.php
class UserController extends BaseController {
public function pageManageUsers() {
// some statements to create page manage users
}
public function addUser()
{
// some statements to add new user
}
}
// public/index.php
// call action UserController->pageManageUser
// when user landing on [site]/index.php/user/manage
$app->get("/user/manage", "UserController:pageManageUsers");
// call action UserController->addUser
// when user post something to [site]/index.php/user/add
$app->post("/user/add", "UserController:addUser");
// app/models/User.php
use Illuminate\Database\Eloquent\Model;
class User extends Model {
protected $table = 'users';
}
// app/controllers/UserController.php
// example rendering 'app/views/manage-users.twig' via controller
class UserController extends BaseController {
public function pageManageUsers() {
$data = array(
// variables you want to creates in view
);
$this->app->render("manage-users.twig", $data);
}
}
// public/index.php
// example rendering 'app/views/manage-users.twig' via Route Closure
$app->get("/users/manage", function() use ($app) {
$data = array(
// variables you want to creates in view
);
$app->render("manage-users.twig", $data);
});