PHP code example of bittokazi / php-simple-mvc-framework
1. Go to this page and download the library: Download bittokazi/php-simple-mvc-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/ */
bittokazi / php-simple-mvc-framework example snippets
sh
Install -> http://localhost/php-mvc/public/install.mvc
Uninstall -> http://localhost/php-mvc/public/uninstall.mvc
Seed -> http://localhost/php-mvc/public/seed.mvc
sh
namespace Database;
use Core\Database;
use Core\Auth;
class all_database extends Database {
public function install() {
$this->query('CREATE TABLE user (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
firstname VARCHAR(30),
lastname VARCHAR(30),
status VARCHAR(30),
role VARCHAR(30)
)');
$this->query('CREATE TABLE user_status (
id INT(3) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL UNIQUE
)');
$this->query('CREATE TABLE user_role (
id INT(3) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL UNIQUE
)');
$this->query('CREATE TABLE user_notes (
id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL UNIQUE,
content TEXT
)');
}
public function seed() {
$this->query("INSERT INTO user_status VALUES('', 'Active')");
$this->query("INSERT INTO user_role VALUES('', 'Administrator')");
$this->query("INSERT INTO user_role VALUES('', 'User')");
$this->query("INSERT INTO user VALUES('', 'admin', '".Auth::CryptBf('password')."', '[email protected]', 'N/A', 'N/A', '1', '1')");
$this->query("INSERT INTO user VALUES('', 'user', '".Auth::CryptBf('password')."', '[email protected]', 'N/A', 'N/A', '1', '2')");
}
public function uninstall() {
$this->query('DROP TABLE user_status');
$this->query('DROP TABLE user_role');
$this->query('DROP TABLE user');
$this->query('DROP TABLE user_notes');
}
}
sh
namespace App\Models;
use Core\Model;
use Core\Auth;
public function all() {
return $this->DB()->prepared_select('SELECT *, user.id as id FROM user INNER JOIN user_role ON user.role=user_role.id', '', array());
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.